Skip to content

Commit

Permalink
feat: use sublabel component in all forms
Browse files Browse the repository at this point in the history
  • Loading branch information
andyesp committed Jun 20, 2023
1 parent 034cda6 commit f9163f7
Show file tree
Hide file tree
Showing 18 changed files with 96 additions and 133 deletions.
4 changes: 4 additions & 0 deletions src/components/Category/CategoryBanner.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
align-items: center;
}

.CategoryBanner__Title {
margin-bottom: 0;
}

.CategoryBanner__Badge {
margin-left: 8px;
border-radius: 4px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Category/CategoryBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function CategoryBanner({ active = true, isNew, type, onClick, hr
</div>
<div>
<div className="CategoryBanner__TitleContainer">
<Text size="lg" weight="semi-bold">
<Text className="CategoryBanner__Title" size="lg" weight="semi-bold">
{t(`category.${type}_title`)}
</Text>
{isNew && <span className="CategoryBanner__Badge NewBadge">{t(`category.new`)}</span>}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/SubLabel.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
font-style: normal;
font-weight: 400;
font-size: 15px;
line-height: 20px;
line-height: 20px !important;
color: var(--black-600);
}
8 changes: 7 additions & 1 deletion src/components/Common/SubLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -14,7 +16,11 @@ const SubLabel = ({ children, isMarkdown }: Props) => {
return <Markdown className="SubLabel">{children}</Markdown>
}

return <p className="SubLabel">{children}</p>
return (
<Text weight="semi-bold" color="secondary" className="SubLabel">
{children}
</Text>
)
}

export default SubLabel
8 changes: 7 additions & 1 deletion src/components/Common/Text/Text.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.Text {
font-stretch: normal;
font-style: normal;
letter-spacing: 0.3px;
}

Expand Down Expand Up @@ -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;
}
15 changes: 13 additions & 2 deletions src/components/Common/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,39 @@ 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({
children,
size = DEFAULT_FONT_SIZE,
weight = DEFAULT_FONT_WEIGHT,
color = DEFAULT_COLOR,
style = DEFAULT_FONT_STYLE,
className,
}: Props) {
return (
<p
className={classNames('Text', className, `Text--size-${size}`, `Text--weight-${weight}`, `Text--color-${color}`)}
className={classNames(
'Text',
`Text--size-${size}`,
`Text--weight-${weight}`,
`Text--color-${color}`,
`Text--style-${style}`,
className
)}
>
{children}
</p>
Expand Down
15 changes: 15 additions & 0 deletions src/components/PostLabel.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Text size="sm" color="secondary" weight="semi-bold" style="italic">
{children}
</Text>
)
}
9 changes: 3 additions & 6 deletions src/components/Proposal/Submit/ProposalSubmitPoiPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -162,9 +163,7 @@ export default function ProposalSubmitPoiPage({ poiType }: Props) {
</ContentSection>
<ContentSection className="CoordinatesField">
<Label>{t(`page.submit_poi.${action}.coordinates_label`)}</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_poi.coordinates_detail')}
</Text>
<SubLabel>{t('page.submit_poi.coordinates_detail')}</SubLabel>
<div className="CoordinatesField__Inputs">
<Field
control={control}
Expand Down Expand Up @@ -212,9 +211,7 @@ export default function ProposalSubmitPoiPage({ poiType }: Props) {
{t('page.submit_poi.description_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t(`page.submit_poi.${action}.description_detail`)}
</Text>
<SubLabel>{t(`page.submit_poi.${action}.description_detail`)}</SubLabel>
<MarkdownField
control={control}
name="description"
Expand Down
2 changes: 1 addition & 1 deletion src/intl/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@
"url_add": "Add another link",
"programmatically_generated_label": "Is this collection programmatically generated?",
"programmatically_generated_description": "The collection you will upload to Decentraland as Linked Wearables is programmatically generated. This means the 3D models you will submit to Decentraland were made this way.",
"programmatically_generated_note": "_In general, large collections of more than 5k NFTs are not created manually, they are systematically generated from individual traits that were designed individually. If your Linked Wearables Collection is made like this, share the details below._",
"programmatically_generated_note": "In general, large collections of more than 5k NFTs are not created manually, they are systematically generated from individual traits that were designed individually. If your Linked Wearables Collection is made like this, share the details below.",
"method_label": "Method",
"method_detail": "Describe the method used to create the programmatic collection. If possible, share proof and links to the repository.",
"method_placeholder": "Describe the method",
Expand Down
5 changes: 2 additions & 3 deletions src/pages/submit/ban-name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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'
Expand Down Expand Up @@ -133,9 +134,7 @@ export default function SubmitBanName() {
{t('page.submit_ban_name.description_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_ban_name.description_detail')}
</Text>
<SubLabel>{t('page.submit_ban_name.description_detail')}</SubLabel>
<MarkdownField
control={control}
name="description"
Expand Down
5 changes: 2 additions & 3 deletions src/pages/submit/catalyst.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -212,9 +213,7 @@ export default function SubmitCatalyst() {
{t('page.submit_catalyst.description_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_catalyst.description_detail')}
</Text>
<SubLabel>{t('page.submit_catalyst.description_detail')}</SubLabel>
<MarkdownField
control={control}
name="description"
Expand Down
21 changes: 6 additions & 15 deletions src/pages/submit/draft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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'
Expand Down Expand Up @@ -158,9 +159,7 @@ export default function SubmitDraftProposal() {
{t('page.submit_draft.summary_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_draft.summary_detail')}
</Text>
<SubLabel>{t('page.submit_draft.summary_detail')}</SubLabel>
<MarkdownField
control={control}
name="summary"
Expand Down Expand Up @@ -192,9 +191,7 @@ export default function SubmitDraftProposal() {
{t('page.submit_draft.abstract_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_draft.abstract_detail')}
</Text>
<SubLabel>{t('page.submit_draft.abstract_detail')}</SubLabel>
<MarkdownField
control={control}
name="abstract"
Expand Down Expand Up @@ -226,9 +223,7 @@ export default function SubmitDraftProposal() {
{t('page.submit_draft.motivation_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_draft.motivation_detail')}
</Text>
<SubLabel>{t('page.submit_draft.motivation_detail')}</SubLabel>
<MarkdownField
control={control}
name="motivation"
Expand Down Expand Up @@ -260,9 +255,7 @@ export default function SubmitDraftProposal() {
{t('page.submit_draft.specification_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_draft.specification_detail')}
</Text>
<SubLabel>{t('page.submit_draft.specification_detail')}</SubLabel>
<MarkdownField
control={control}
name="specification"
Expand Down Expand Up @@ -294,9 +287,7 @@ export default function SubmitDraftProposal() {
{t('page.submit_draft.conclusion_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_draft.conclusion_detail')}
</Text>
<SubLabel>{t('page.submit_draft.conclusion_detail')}</SubLabel>
<MarkdownField
control={control}
name="conclusion"
Expand Down
29 changes: 8 additions & 21 deletions src/pages/submit/governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { SelectField } from 'decentraland-ui/dist/components/SelectField/SelectF
import { Governance } from '../../clients/Governance'
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'
Expand Down Expand Up @@ -181,9 +182,7 @@ export default function SubmitGovernanceProposal() {
{t('page.submit_governance.summary_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_governance.summary_detail')}
</Text>
<SubLabel>{t('page.submit_governance.summary_detail')}</SubLabel>
<MarkdownField
control={control}
name="summary"
Expand Down Expand Up @@ -216,9 +215,7 @@ export default function SubmitGovernanceProposal() {
{t('page.submit_governance.abstract_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_governance.abstract_detail')}
</Text>
<SubLabel>{t('page.submit_governance.abstract_detail')}</SubLabel>
<MarkdownField
control={control}
name="abstract"
Expand Down Expand Up @@ -251,9 +248,7 @@ export default function SubmitGovernanceProposal() {
{t('page.submit_governance.motivation_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_governance.motivation_detail')}
</Text>
<SubLabel>{t('page.submit_governance.motivation_detail')}</SubLabel>
<MarkdownField
control={control}
name="motivation"
Expand Down Expand Up @@ -286,9 +281,7 @@ export default function SubmitGovernanceProposal() {
{t('page.submit_governance.specification_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_governance.specification_detail')}
</Text>
<SubLabel>{t('page.submit_governance.specification_detail')}</SubLabel>
<MarkdownField
control={control}
name="specification"
Expand Down Expand Up @@ -321,9 +314,7 @@ export default function SubmitGovernanceProposal() {
{t('page.submit_governance.impacts_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_governance.impacts_detail')}
</Text>
<SubLabel>{t('page.submit_governance.impacts_detail')}</SubLabel>
<MarkdownField
control={control}
name="impacts"
Expand Down Expand Up @@ -356,9 +347,7 @@ export default function SubmitGovernanceProposal() {
{t('page.submit_governance.implementation_pathways_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_governance.implementation_pathways_detail')}
</Text>
<SubLabel>{t('page.submit_governance.implementation_pathways_detail')}</SubLabel>
<MarkdownField
control={control}
name="implementation_pathways"
Expand Down Expand Up @@ -391,9 +380,7 @@ export default function SubmitGovernanceProposal() {
{t('page.submit_governance.conclusion_label')}
<MarkdownNotice />
</Label>
<Text color="secondary" className="ProposalSubmit__DescriptionDetails">
{t('page.submit_governance.conclusion_detail')}
</Text>
<SubLabel>{t('page.submit_governance.conclusion_detail')}</SubLabel>
<MarkdownField
control={control}
name="conclusion"
Expand Down
Loading

0 comments on commit f9163f7

Please sign in to comment.