From f9163f7b9ca1cd053cf2047e5832fadfa4e05074 Mon Sep 17 00:00:00 2001 From: Andy Espagnolo Date: Tue, 20 Jun 2023 12:59:56 -0300 Subject: [PATCH] feat: use sublabel component in all forms --- src/components/Category/CategoryBanner.css | 4 ++ src/components/Category/CategoryBanner.tsx | 2 +- src/components/Common/SubLabel.css | 2 +- src/components/Common/SubLabel.tsx | 8 +++- src/components/Common/Text/Text.css | 8 +++- src/components/Common/Text/Text.tsx | 15 ++++++- src/components/PostLabel.tsx | 15 +++++++ .../Proposal/Submit/ProposalSubmitPoiPage.tsx | 9 ++-- src/intl/en.json | 2 +- src/pages/submit/ban-name.tsx | 5 +-- src/pages/submit/catalyst.tsx | 5 +-- src/pages/submit/draft.tsx | 21 +++------ src/pages/submit/governance.tsx | 29 ++++-------- src/pages/submit/linked-wearables.tsx | 44 +++++-------------- src/pages/submit/pitch.tsx | 20 +++------ src/pages/submit/poll.tsx | 3 -- src/pages/submit/submit.css | 12 ----- src/pages/submit/tender.tsx | 25 +++-------- 18 files changed, 96 insertions(+), 133 deletions(-) create mode 100644 src/components/PostLabel.tsx diff --git a/src/components/Category/CategoryBanner.css b/src/components/Category/CategoryBanner.css index b47bdf7f2..67a9d85f7 100644 --- a/src/components/Category/CategoryBanner.css +++ b/src/components/Category/CategoryBanner.css @@ -33,6 +33,10 @@ align-items: center; } +.CategoryBanner__Title { + margin-bottom: 0; +} + .CategoryBanner__Badge { margin-left: 8px; border-radius: 4px; diff --git a/src/components/Category/CategoryBanner.tsx b/src/components/Category/CategoryBanner.tsx index 89f44e5d9..7bfde6f67 100644 --- a/src/components/Category/CategoryBanner.tsx +++ b/src/components/Category/CategoryBanner.tsx @@ -88,7 +88,7 @@ export default function CategoryBanner({ active = true, isNew, type, onClick, hr
- + {t(`category.${type}_title`)} {isNew && {t(`category.new`)}} diff --git a/src/components/Common/SubLabel.css b/src/components/Common/SubLabel.css index 15ce83a84..51c255137 100644 --- a/src/components/Common/SubLabel.css +++ b/src/components/Common/SubLabel.css @@ -7,6 +7,6 @@ font-style: normal; font-weight: 400; font-size: 15px; - line-height: 20px; + line-height: 20px !important; color: var(--black-600); } diff --git a/src/components/Common/SubLabel.tsx b/src/components/Common/SubLabel.tsx index 8e024786c..76c7ab19d 100644 --- a/src/components/Common/SubLabel.tsx +++ b/src/components/Common/SubLabel.tsx @@ -2,6 +2,8 @@ import React from 'react' import Markdown from 'decentraland-gatsby/dist/components/Text/Markdown' +import Text from './Text/Text' + import './SubLabel.css' interface Props { @@ -14,7 +16,11 @@ const SubLabel = ({ children, isMarkdown }: Props) => { return {children} } - return

{children}

+ return ( + + {children} + + ) } export default SubLabel diff --git a/src/components/Common/Text/Text.css b/src/components/Common/Text/Text.css index efcc7b41f..57d0dd402 100644 --- a/src/components/Common/Text/Text.css +++ b/src/components/Common/Text/Text.css @@ -1,6 +1,5 @@ .Text { font-stretch: normal; - font-style: normal; letter-spacing: 0.3px; } @@ -44,3 +43,10 @@ .Text.Text--color-secondary { color: var(--secondary-text); } + +.Text.Text--style-normal { + font-style: normal; +} +.Text.Text--style-italic { + font-style: italic; +} diff --git a/src/components/Common/Text/Text.tsx b/src/components/Common/Text/Text.tsx index 3647f2e65..400af369c 100644 --- a/src/components/Common/Text/Text.tsx +++ b/src/components/Common/Text/Text.tsx @@ -7,16 +7,19 @@ import './Text.css' const DEFAULT_COLOR: TextColor = 'default' const DEFAULT_FONT_WEIGHT: FontWeight = 'normal' const DEFAULT_FONT_SIZE: FontSize = 'md' +const DEFAULT_FONT_STYLE: FontStyle = 'normal' type FontSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' type FontWeight = 'bold' | 'semi-bold' | 'normal' type TextColor = 'default' | 'primary' | 'secondary' +type FontStyle = 'normal' | 'italic' interface Props { children?: React.ReactNode + className?: string size?: FontSize weight?: FontWeight color?: TextColor - className?: string + style?: FontStyle } export default function Text({ @@ -24,11 +27,19 @@ export default function Text({ size = DEFAULT_FONT_SIZE, weight = DEFAULT_FONT_WEIGHT, color = DEFAULT_COLOR, + style = DEFAULT_FONT_STYLE, className, }: Props) { return (

{children}

diff --git a/src/components/PostLabel.tsx b/src/components/PostLabel.tsx new file mode 100644 index 000000000..226dad587 --- /dev/null +++ b/src/components/PostLabel.tsx @@ -0,0 +1,15 @@ +import React from 'react' + +import Text from './Common/Text/Text' + +interface Props { + children: string +} + +export default function PostLabel({ children }: Props) { + return ( + + {children} + + ) +} diff --git a/src/components/Proposal/Submit/ProposalSubmitPoiPage.tsx b/src/components/Proposal/Submit/ProposalSubmitPoiPage.tsx index 1ccbb1273..a51ed69bc 100644 --- a/src/components/Proposal/Submit/ProposalSubmitPoiPage.tsx +++ b/src/components/Proposal/Submit/ProposalSubmitPoiPage.tsx @@ -17,6 +17,7 @@ import locations from '../../../utils/locations' import Field from '../../Common/Form/Field' import MarkdownField from '../../Common/Form/MarkdownField' import Label from '../../Common/Label' +import SubLabel from '../../Common/SubLabel' import Text from '../../Common/Text/Text' import ErrorMessage from '../../Error/ErrorMessage' import MarkdownNotice from '../../Form/MarkdownNotice' @@ -162,9 +163,7 @@ export default function ProposalSubmitPoiPage({ poiType }: Props) { - - {t('page.submit_poi.coordinates_detail')} - + {t('page.submit_poi.coordinates_detail')}
- - {t(`page.submit_poi.${action}.description_detail`)} - + {t(`page.submit_poi.${action}.description_detail`)} - - {t('page.submit_ban_name.description_detail')} - + {t('page.submit_ban_name.description_detail')} - - {t('page.submit_catalyst.description_detail')} - + {t('page.submit_catalyst.description_detail')} - - {t('page.submit_draft.summary_detail')} - + {t('page.submit_draft.summary_detail')} - - {t('page.submit_draft.abstract_detail')} - + {t('page.submit_draft.abstract_detail')} - - {t('page.submit_draft.motivation_detail')} - + {t('page.submit_draft.motivation_detail')} - - {t('page.submit_draft.specification_detail')} - + {t('page.submit_draft.specification_detail')} - - {t('page.submit_draft.conclusion_detail')} - + {t('page.submit_draft.conclusion_detail')} - - {t('page.submit_governance.summary_detail')} - + {t('page.submit_governance.summary_detail')} - - {t('page.submit_governance.abstract_detail')} - + {t('page.submit_governance.abstract_detail')} - - {t('page.submit_governance.motivation_detail')} - + {t('page.submit_governance.motivation_detail')} - - {t('page.submit_governance.specification_detail')} - + {t('page.submit_governance.specification_detail')} - - {t('page.submit_governance.impacts_detail')} - + {t('page.submit_governance.impacts_detail')} - - {t('page.submit_governance.implementation_pathways_detail')} - + {t('page.submit_governance.implementation_pathways_detail')} - - {t('page.submit_governance.conclusion_detail')} - + {t('page.submit_governance.conclusion_detail')} - - {t(`page.submit_linked_wearables.${params.section}_detail`, detailOptions)} - + {t(`page.submit_linked_wearables.${params.section}_detail`, detailOptions)} {errors && ( {errors[params.section]?.message} @@ -329,9 +329,7 @@ export default function SubmitLinkedWearables() { - - {t('page.submit_linked_wearables.name_detail')} - + {t('page.submit_linked_wearables.name_detail')} - - {t('page.submit_linked_wearables.marketplace_link_detail')} - + {t('page.submit_linked_wearables.marketplace_link_detail')} - - {t('page.submit_linked_wearables.nft_collections_detail')} - + {t('page.submit_linked_wearables.nft_collections_detail')} - - {t('page.submit_linked_wearables.motivation_detail')} - + {t('page.submit_linked_wearables.motivation_detail')} - - {t('page.submit_linked_wearables.items_detail')} - + {t('page.submit_linked_wearables.items_detail')} - - {t('page.submit_linked_wearables.governance_detail')} - + {t('page.submit_linked_wearables.governance_detail')} - - {t('page.submit_linked_wearables.programmatically_generated_description')} - + {t('page.submit_linked_wearables.programmatically_generated_description')}
- - - {t('page.submit_linked_wearables.programmatically_generated_note') || ''} - - + {t('page.submit_linked_wearables.programmatically_generated_note')}
{values.programmatically_generated && ( @@ -556,9 +538,7 @@ export default function SubmitLinkedWearables() { {t('page.submit_linked_wearables.method_label')} - - {t('page.submit_linked_wearables.method_detail')} - + {t('page.submit_linked_wearables.method_detail')} - {t('page.submit_pitch.initiative_name_postlabel')} + {t('page.submit_pitch.initiative_name_postlabel')} - - {t('page.submit_pitch.target_audience_detail')} - + {t('page.submit_pitch.target_audience_detail')} - - {t('page.submit_pitch.problem_statement_detail')} - + {t('page.submit_pitch.problem_statement_detail')} - - {t('page.submit_pitch.proposed_solution_detail')} - + {t('page.submit_pitch.proposed_solution_detail')} - - {t('page.submit_pitch.relevance_detail')} - + {t('page.submit_pitch.relevance_detail')} - - {' '} - {errors && ( {errors.choices?.message} diff --git a/src/pages/submit/submit.css b/src/pages/submit/submit.css index ed81e2732..9ae85c63b 100644 --- a/src/pages/submit/submit.css +++ b/src/pages/submit/submit.css @@ -34,10 +34,6 @@ font-size: 15px; } -.ProposalSubmit__DescriptionDetails { - margin-bottom: 2px; -} - .ContentLayout .ContentLayout__Section .ui.radio.checkbox label { font-size: 17px; } @@ -87,11 +83,3 @@ gap: 10px; margin-bottom: 10px; } - -.Input__PostLabel { - font-style: italic; - font-weight: 400; - font-size: 13px; - line-height: 17px; - color: var(--black-600); -} diff --git a/src/pages/submit/tender.tsx b/src/pages/submit/tender.tsx index cbdf01039..446f0ab3a 100644 --- a/src/pages/submit/tender.tsx +++ b/src/pages/submit/tender.tsx @@ -16,6 +16,7 @@ import { Governance } from '../../clients/Governance' import Field from '../../components/Common/Form/Field' import MarkdownField from '../../components/Common/Form/MarkdownField' import Label from '../../components/Common/Label' +import SubLabel from '../../components/Common/SubLabel' import Text from '../../components/Common/Text/Text' import ErrorMessage from '../../components/Error/ErrorMessage' import MarkdownNotice from '../../components/Form/MarkdownNotice' @@ -178,9 +179,7 @@ export default function SubmitTenderProposal() { {t('page.submit_tender.summary_label')} - - {t('page.submit_tender.summary_description')} - + {t('page.submit_tender.summary_description')} - - {t('page.submit_tender.problem_statement_description')} - + {t('page.submit_tender.problem_statement_description')} - - {t('page.submit_tender.technical_specification_description')} - + {t('page.submit_tender.technical_specification_description')} - - {t('page.submit_tender.use_cases_description')} - + {t('page.submit_tender.use_cases_description')} - - {t('page.submit_tender.deliverables_description')} - + {t('page.submit_tender.deliverables_description')} - - {t('page.submit_tender.target_release_quarter_description')} - + {t('page.submit_tender.target_release_quarter_description')}