Skip to content

Commit

Permalink
feat: use guidelines component across app
Browse files Browse the repository at this point in the history
  • Loading branch information
benfurber committed May 31, 2024
1 parent aa7053f commit 49e62bb
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 195 deletions.
6 changes: 3 additions & 3 deletions src/pages/Howto/Content/Common/Howto.form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import {
HowtoFieldTags,
HowtoFieldTime,
HowtoFieldTitle,
HowtoPostingGuidelines,
HowToSubmitStatus,
PostingGuidelines,
} from '.'

import type { FormApi } from 'final-form'
Expand Down Expand Up @@ -172,7 +172,7 @@ export const HowtoForm = observer((props: IProps) => {
<Box
sx={{ mt: '20px', display: ['block', 'block', 'none'] }}
>
<PostingGuidelines />
<HowtoPostingGuidelines />
</Box>
<Card mt={3}>
<Flex
Expand Down Expand Up @@ -250,7 +250,7 @@ export const HowtoForm = observer((props: IProps) => {
}}
>
<Box sx={{ display: ['none', 'none', 'block'] }}>
<PostingGuidelines />
<HowtoPostingGuidelines />
</Box>

<HowtoButtonDraft
Expand Down
55 changes: 55 additions & 0 deletions src/pages/Howto/Content/Common/HowtoPostingGuidelines.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { ExternalLink, Guidelines } from 'oa-components'

export const HowtoPostingGuidelines = () => (
<Guidelines
title="How does it work?"
steps={[
<>
Choose what you want to share{' '}
<span role="img" aria-label="raised-hand">
🙌
</span>
</>,
<>
Read{' '}
<ExternalLink sx={{ color: 'blue' }} href="/academy/create/howto">
our guidelines{' '}
<span role="img" aria-label="nerd-face">
🤓
</span>
</ExternalLink>
</>,
<>
Prepare your text & images{' '}
<span role="img" aria-label="archive-box">
🗄️
</span>
</>,
<>
Create your How-to{' '}
<span role="img" aria-label="writing-hand">
✍️
</span>
</>,
<>
Click on “Publish”{' '}
<span role="img" aria-label="mouse">
🖱️
</span>
</>,
<>We will either send you feedback, or</>,
<>
Approve if everything is okay{' '}
<span role="img" aria-label="tick-validate">
</span>
</>,
<>
Be proud{' '}
<span role="img" aria-label="simple-smile">
🙂
</span>
</>,
]}
/>
)
60 changes: 0 additions & 60 deletions src/pages/Howto/Content/Common/PostingGuidelines.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/Howto/Content/Common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export { HowtoFieldTags } from './HowtoFieldTags'
export { HowtoFieldTime } from './HowtoFieldTime'
export { HowtoFieldTitle } from './HowtoFieldTitle'
export { HowToSubmitStatus } from './SubmitStatus'
export { PostingGuidelines } from './PostingGuidelines'
export { HowtoPostingGuidelines } from './HowtoPostingGuidelines'
48 changes: 0 additions & 48 deletions src/pages/Question/Content/Common/PostingGuidelines.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions src/pages/Question/Content/Common/QuestionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Button, ElWithBeforeIcon } from 'oa-components'
import { IModerationStatus } from 'oa-shared'
import IconHeaderHowto from 'src/assets/images/header-section/howto-header-icon.svg'
import { logger } from 'src/logger'
import { PostingGuidelines } from 'src/pages/Question/Content/Common'
import { QuestionPostingGuidelines } from 'src/pages/Question/Content/Common'
import * as LABELS from 'src/pages/Question/labels'
import { useQuestionStore } from 'src/stores/Question/question.store'
import { setAllowDraftSaveFalse } from 'src/utils/validators'
Expand Down Expand Up @@ -90,7 +90,7 @@ export const QuestionForm = (props: IProps) => {
</Flex>
</Card>
<Box sx={{ mt: '20px', display: ['block', 'block', 'none'] }}>
<PostingGuidelines />
<QuestionPostingGuidelines />
</Box>
<Card sx={{ marginTop: 4, padding: 4, overflow: 'visible' }}>
<QuestionTitleField
Expand Down Expand Up @@ -123,7 +123,7 @@ export const QuestionForm = (props: IProps) => {
}}
>
<Box sx={{ display: ['none', 'none', 'block'] }}>
<PostingGuidelines />
<QuestionPostingGuidelines />
</Box>
<Button
large
Expand Down
51 changes: 51 additions & 0 deletions src/pages/Question/Content/Common/QuestionPostingGuidelines.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { useTheme } from '@emotion/react'
import { ExternalLink, Guidelines } from 'oa-components'

export const QuestionPostingGuidelines = () => {
const theme = useTheme()

const steps = [
<>
Write your question{' '}
<span role="img" aria-label="raised-hand">
🙌
</span>
</>,
<>
Double check if it's already made and{' '}
<ExternalLink sx={{ color: 'blue' }} href="/questions">
search{' '}
</ExternalLink>
</>,
<>
Provide enough info for people to help{' '}
<span role="img" aria-label="archive-box">
🗄️
</span>
</>,
<>
Add a category and search so others can find it{' '}
<span role="img" aria-label="writing-hand">
✍️
</span>
</>,
<>Come back to comment the answers</>,
<>
Get your best answer{' '}
<span role="img" aria-label="simple-smile">
🙂
</span>
</>,
]

if (theme.questionsGuidelinesURL) {
steps.unshift(<>
Have a look at our{' '}
<ExternalLink sx={{ color: 'blue' }} href={theme.questionsGuidelinesURL}>
profile guidelines.
</ExternalLink>
</>)
}

return <Guidelines title="How does it work?" steps={steps} />
}
2 changes: 1 addition & 1 deletion src/pages/Question/Content/Common/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { PostingGuidelines } from './PostingGuidelines'
export { QuestionPostingGuidelines } from './QuestionPostingGuidelines'
51 changes: 0 additions & 51 deletions src/pages/Research/Content/Common/PostingGuidelines.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions src/pages/Research/Content/Common/Research.form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { usePrompt } from 'src/common/hooks/usePrompt'
import { researchStatusOptions } from 'src/models/research.models'
import { CategoriesSelect } from 'src/pages/Howto/Category/CategoriesSelect'
import {
PostingGuidelines,
ResearchErrors,
ResearchPostingGuidelines,
ResearchSubmitStatus,
} from 'src/pages/Research/Content/Common'
import { useResearchStore } from 'src/stores/Research/research.store'
Expand Down Expand Up @@ -219,7 +219,7 @@ const ResearchForm = observer((props: IProps) => {
<Box
sx={{ mt: '20px', display: ['block', 'block', 'none'] }}
>
<PostingGuidelines />
<ResearchPostingGuidelines />
</Box>
<Card mt={3} sx={{ overflow: 'visible' }}>
<Flex
Expand Down Expand Up @@ -370,7 +370,7 @@ const ResearchForm = observer((props: IProps) => {
}}
>
<Box sx={{ display: ['none', 'none', 'block'] }}>
<PostingGuidelines />
<ResearchPostingGuidelines />
</Box>

<Button
Expand Down
Loading

0 comments on commit 49e62bb

Please sign in to comment.