diff --git a/package.json b/package.json index 65f1a89..2bcf597 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@giveth/ui-design-system", - "version": "1.11.21", + "version": "1.11.22", "files": [ "/lib" ], diff --git a/src/components/buttonLinks/ButtonLink.tsx b/src/components/buttonLinks/ButtonLink.tsx index 0064fef..a40fcb8 100644 --- a/src/components/buttonLinks/ButtonLink.tsx +++ b/src/components/buttonLinks/ButtonLink.tsx @@ -16,7 +16,7 @@ const ButtonLinkContainer = styled.span` gap: 4px; white-space: nowrap; ${props => { - switch (props.linkType) { + switch (props.$linkType) { case 'primary': return props.disabled ? css` @@ -110,7 +110,7 @@ const ButtonLinkContainer = styled.span` :hover { ${props => { if (props.disabled) return ''; - switch (props.linkType) { + switch (props.$linkType) { case 'primary': return css` color: ${neutralColors.gray[100]}; @@ -169,7 +169,7 @@ export const ButtonLink: FC = forwardRef( href={href} as={isExternal ? 'a' : 'span'} target={target} - linkType={linkType} + $linkType={linkType} disabled={disabled} size={size} className={className} diff --git a/src/components/buttonLinks/OutlineButtonLink.tsx b/src/components/buttonLinks/OutlineButtonLink.tsx index a1d3542..793527d 100644 --- a/src/components/buttonLinks/OutlineButtonLink.tsx +++ b/src/components/buttonLinks/OutlineButtonLink.tsx @@ -18,7 +18,7 @@ const ButtonLinkContainer = styled.span` gap: 4px; white-space: nowrap; ${props => { - switch (props.linkType) { + switch (props.$linkType) { case 'primary': return props.disabled ? css` @@ -55,7 +55,7 @@ const ButtonLinkContainer = styled.span` :hover { ${props => { if (props.disabled) return ''; - switch (props.linkType) { + switch (props.$linkType) { case 'primary': return css` color: ${brandColors.pinky[500]}; @@ -97,7 +97,7 @@ export const OutlineLinkButton: FC = forwardRef( ref={ref as any} href={href} target={target} - linkType={linkType} + $linkType={linkType} size={size} disabled={disabled} className={className} diff --git a/src/components/buttonLinks/type.ts b/src/components/buttonLinks/type.ts index 80218fe..07f0ad3 100644 --- a/src/components/buttonLinks/type.ts +++ b/src/components/buttonLinks/type.ts @@ -1,22 +1,27 @@ import type { ReactNode, ComponentPropsWithoutRef } from 'react'; +export type ButtonStyleType = + | 'primary' + | 'secondary' + | 'texty' + | 'texty-gray' + | 'texty-primary' + | 'texty-secondary'; + +export type ButtonSize = 'small' | 'medium' | 'large'; + export interface IButtonLinkContainerProps { - linkType?: - | 'primary' - | 'secondary' - | 'texty' - | 'texty-gray' - | 'texty-primary' - | 'texty-secondary'; - size?: 'small' | 'medium' | 'large'; + $linkType?: ButtonStyleType; + size?: ButtonSize; disabled?: boolean; - isExternal?: boolean; } -export interface IButtonLinkProps - extends ComponentPropsWithoutRef<'a'>, - IButtonLinkContainerProps { +export interface IButtonLinkProps extends ComponentPropsWithoutRef<'a'> { icon?: ReactNode; leftIcon?: ReactNode; label: string; + linkType?: ButtonStyleType; + isExternal?: boolean; + size?: ButtonSize; + disabled?: boolean; } diff --git a/src/components/buttons/Button.tsx b/src/components/buttons/Button.tsx index 1578964..3174b79 100644 --- a/src/components/buttons/Button.tsx +++ b/src/components/buttons/Button.tsx @@ -19,7 +19,7 @@ const ButtonContainer = styled.button` user-select: none; ${props => { if (props.disabled) { - if (props.buttonType === 'texty') { + if (props.$buttonType === 'texty') { return css` color: ${brandColors.giv[500]}; background-color: unset; @@ -27,7 +27,7 @@ const ButtonContainer = styled.button` opacity: 0.5; `; } - if (props.buttonType === 'texty-gray') { + if (props.$buttonType === 'texty-gray') { return css` color: ${neutralColors.gray[300]}; background-color: unset; @@ -35,7 +35,7 @@ const ButtonContainer = styled.button` opacity: 0.5; `; } - if (props.buttonType === 'texty-primary') { + if (props.$buttonType === 'texty-primary') { return css` color: ${brandColors.pinky[500]}; background-color: unset; @@ -43,7 +43,7 @@ const ButtonContainer = styled.button` opacity: 0.5; `; } - if (props.buttonType === 'texty-secondary') { + if (props.$buttonType === 'texty-secondary') { return css` color: ${brandColors.giv[500]}; background-color: unset; @@ -51,7 +51,7 @@ const ButtonContainer = styled.button` opacity: 0.5; `; } - if (props.buttonType === 'primary') { + if (props.$buttonType === 'primary') { return css` background-color: ${brandColors.pinky[300]}; color: ${brandColors.pinky[200]}; @@ -63,7 +63,7 @@ const ButtonContainer = styled.button` opacity: 0.5; `; } - switch (props.buttonType) { + switch (props.$buttonType) { case 'primary': return css` color: ${neutralColors.gray[100]}; @@ -109,7 +109,7 @@ const ButtonContainer = styled.button` :hover { ${props => { if (props.disabled) return ''; - switch (props.buttonType) { + switch (props.$buttonType) { case 'primary': return css` color: ${neutralColors.gray[100]}; @@ -161,7 +161,7 @@ export const Button: FC = ({ }) => { return ( = ({ > {loading && ( - + )} {leftIcon && leftIcon} diff --git a/src/components/buttons/OutlineButton.tsx b/src/components/buttons/OutlineButton.tsx index 1be0a02..320be35 100644 --- a/src/components/buttons/OutlineButton.tsx +++ b/src/components/buttons/OutlineButton.tsx @@ -20,7 +20,7 @@ const ButtonContainer = styled.button` white-space: nowrap; user-select: none; ${props => { - switch (props.buttonType) { + switch (props.$buttonType) { case 'primary': return props.disabled ? css` @@ -64,7 +64,7 @@ const ButtonContainer = styled.button` :hover { ${props => { if (props.disabled) return ''; - switch (props.buttonType) { + switch (props.$buttonType) { case 'primary': return css` color: ${brandColors.pinky[500]}; @@ -99,7 +99,7 @@ export const OutlineButton: FC = ({ }) => { return ( = ({ > {loading && ( - + )} {leftIcon && leftIcon} diff --git a/src/components/buttons/common.tsx b/src/components/buttons/common.tsx index f061170..0d1fa93 100644 --- a/src/components/buttons/common.tsx +++ b/src/components/buttons/common.tsx @@ -13,12 +13,12 @@ export const Loader = styled.div` border: 3px solid ${props => { if (props.disabled) { - switch (props.buttonType) { + switch (props.$buttonType) { case 'primary': return brandColors.pinky[400]; } } - switch (props.buttonType) { + switch (props.$buttonType) { case 'primary': return brandColors.pinky[600]; case 'secondary': diff --git a/src/components/buttons/type.ts b/src/components/buttons/type.ts index 7f541a7..8a9cdf0 100644 --- a/src/components/buttons/type.ts +++ b/src/components/buttons/type.ts @@ -1,22 +1,18 @@ import type { ReactNode, ComponentPropsWithoutRef } from 'react'; +import { ButtonSize, ButtonStyleType } from '../buttonLinks/type'; export interface IButtonContainerProps { - buttonType?: - | 'primary' - | 'secondary' - | 'texty' - | 'texty-gray' - | 'texty-primary' - | 'texty-secondary'; + $buttonType?: ButtonStyleType; disabled?: boolean; - size?: 'small' | 'medium' | 'large'; + size?: ButtonSize; } -export interface IButtonProps - extends ComponentPropsWithoutRef<'button'>, - IButtonContainerProps { +export interface IButtonProps extends ComponentPropsWithoutRef<'button'> { loading?: boolean; label: string; icon?: ReactNode; leftIcon?: ReactNode; + buttonType?: ButtonStyleType; + disabled?: boolean; + size?: ButtonSize; } diff --git a/src/components/index.ts b/src/components/index.ts index 68945ab..f36a83d 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -30,6 +30,7 @@ export * from './buttonLinks/ButtonLink'; export * from './buttonLinks/OutlineButtonLink'; export * from './layout/Grid'; +export * from './layout/Flex'; export * from './icons'; export * from './icons/type'; diff --git a/src/components/layout/Flex.tsx b/src/components/layout/Flex.tsx new file mode 100644 index 0000000..587095a --- /dev/null +++ b/src/components/layout/Flex.tsx @@ -0,0 +1,39 @@ +import { type CSSProperties } from 'react'; +import styled from 'styled-components'; + +interface IFlexProps { + $flexWrap?: boolean; + $alignItems?: CSSProperties['alignItems']; + $justifyContent?: CSSProperties['justifyContent']; + $flexDirection?: CSSProperties['flexDirection']; + gap?: string; +} + +export const Flex = styled.div` + display: flex; + flex-direction: ${props => + props.$flexDirection ? props.$flexDirection : 'initial'}; + flex-wrap: ${props => (props.$flexWrap ? 'wrap' : 'nowrap')}; + align-items: ${props => + props.$alignItems ? props.$alignItems : 'initial'}; + justify-content: ${props => + props.$justifyContent ? props.$justifyContent : 'initial'}; + gap: ${props => props.gap}; +`; + +interface IFlexCenter { + gap?: string; + direction?: CSSProperties['flexDirection']; +} + +export const FlexCenter = styled.div` + display: flex; + justify-content: center; + align-items: center; + gap: ${props => props.gap}; + flex-direction: ${props => props.direction}; +`; + +export const FlexSpacer = styled.div` + flex: 1; +`; diff --git a/src/components/typography/Overline.tsx b/src/components/typography/Overline.tsx index 3460c24..1ef88d8 100644 --- a/src/components/typography/Overline.tsx +++ b/src/components/typography/Overline.tsx @@ -1,7 +1,7 @@ import styled from 'styled-components'; export interface IOverlineProps { - styleType?: 'Small' | 'Regular' | 'Italic'; + $styleType?: 'Small' | 'Regular' | 'Italic'; } export const Overline = styled.span` @@ -10,7 +10,7 @@ export const Overline = styled.span` line-height: 132%; color: ${props => (props.color ? props.color : 'inherit')}; ${props => { - switch (props.styleType) { + switch (props.$styleType) { case 'Small': return 'font-size: 0.625rem;font-style: normal;font-weight: 500;'; case 'Regular': diff --git a/src/components/typography/body/Caption.tsx b/src/components/typography/body/Caption.tsx index 8c5dc56..e5e58d7 100644 --- a/src/components/typography/body/Caption.tsx +++ b/src/components/typography/body/Caption.tsx @@ -1,14 +1,14 @@ import styled from 'styled-components'; export interface ICaptionProps { - medium?: boolean; + $medium?: boolean; } export const Caption = styled.div` /* Body/Caption */ font-family: Red Hat Text, sans-serif; font-style: normal; - font-weight: ${props => (props.medium ? 500 : 400)}; + font-weight: ${props => (props.$medium ? 500 : 400)}; font-size: 0.875rem; line-height: 150%; color: ${props => (props.color ? props.color : 'inherit')}; diff --git a/src/components/typography/displays/D.tsx b/src/components/typography/displays/D.tsx new file mode 100644 index 0000000..d5bf345 --- /dev/null +++ b/src/components/typography/displays/D.tsx @@ -0,0 +1,10 @@ +import styled from 'styled-components'; + +export const D = styled.div` + /* Display/D1 */ + font-family: TeX Gyre Adventor, sans-serif; + font-style: normal; + font-weight: 700; + letter-spacing: -0.04em; + color: ${props => (props.color ? props.color : 'inherit')}; +`; diff --git a/src/components/typography/displays/D1.tsx b/src/components/typography/displays/D1.tsx index 8e67f6e..b3275df 100644 --- a/src/components/typography/displays/D1.tsx +++ b/src/components/typography/displays/D1.tsx @@ -1,15 +1,11 @@ import styled from 'styled-components'; import { mediaQueries } from '../../../common/deviceSize'; +import { D } from './D'; -export const D1 = styled.div` +export const D1 = styled(D)` /* Display/D1 */ - font-family: TeX Gyre Adventor, sans-serif; - font-style: normal; - font-weight: 700; font-size: 5rem; line-height: 130%; - letter-spacing: -0.04em; - color: ${props => (props.color ? props.color : 'inherit')}; ${mediaQueries.tablet} { font-size: 6.69rem; } diff --git a/src/components/typography/displays/D2.tsx b/src/components/typography/displays/D2.tsx index 82a2747..91442c9 100644 --- a/src/components/typography/displays/D2.tsx +++ b/src/components/typography/displays/D2.tsx @@ -1,15 +1,11 @@ import styled from 'styled-components'; import { mediaQueries } from '../../../common/deviceSize'; +import { D } from './D'; -export const D2 = styled.div` +export const D2 = styled(D)` /* Display/D2 */ - font-family: TeX Gyre Adventor, sans-serif; - font-style: normal; - font-weight: 700; font-size: 4.625rem; line-height: 130%; - letter-spacing: -0.04em; - color: ${props => (props.color ? props.color : 'inherit')}; ${mediaQueries.tablet} { font-size: 6.06rem; } diff --git a/src/components/typography/displays/D3.tsx b/src/components/typography/displays/D3.tsx index 1cc19c7..cc32450 100644 --- a/src/components/typography/displays/D3.tsx +++ b/src/components/typography/displays/D3.tsx @@ -1,15 +1,11 @@ import styled from 'styled-components'; import { mediaQueries } from '../../../common/deviceSize'; +import { D } from './D'; -export const D3 = styled.div` +export const D3 = styled(D)` /* Display/D3 */ - font-family: TeX Gyre Adventor, sans-serif; - font-style: normal; - font-weight: 700; font-size: 4.25rem; line-height: 120%; - letter-spacing: -0.04em; - color: ${props => (props.color ? props.color : 'inherit')}; ${mediaQueries.tablet} { font-size: 5.5rem; } diff --git a/src/stories/Button.stories.tsx b/src/stories/Button.stories.tsx index db67f7a..306557d 100644 --- a/src/stories/Button.stories.tsx +++ b/src/stories/Button.stories.tsx @@ -9,7 +9,7 @@ export default { } as ComponentMeta; const Template: ComponentStory = args => ( - + ); export const Primary = Template.bind({}); diff --git a/src/stories/ButtonLink.stories.tsx b/src/stories/ButtonLink.stories.tsx index 6c2ad31..23598e7 100644 --- a/src/stories/ButtonLink.stories.tsx +++ b/src/stories/ButtonLink.stories.tsx @@ -8,7 +8,7 @@ export default { } as ComponentMeta; const Template: ComponentStory = args => ( - {args.label} + {args.title} ); export const Primary = Template.bind({}); diff --git a/src/stories/OutlineButton.stories.tsx b/src/stories/OutlineButton.stories.tsx index 3cbce9f..138c375 100644 --- a/src/stories/OutlineButton.stories.tsx +++ b/src/stories/OutlineButton.stories.tsx @@ -9,7 +9,7 @@ export default { } as ComponentMeta; const Template: ComponentStory = args => ( - {args.label} + {args.title} ); export const OutlinePrimary = Template.bind({}); diff --git a/src/stories/OutlineButtonLink.stories.tsx b/src/stories/OutlineButtonLink.stories.tsx index 51c9ccb..7f410c5 100644 --- a/src/stories/OutlineButtonLink.stories.tsx +++ b/src/stories/OutlineButtonLink.stories.tsx @@ -9,7 +9,7 @@ export default { } as ComponentMeta; const Template: ComponentStory = args => ( - {args.label} + {args.title} ); export const OutlinePrimary = Template.bind({}); diff --git a/src/stories/typography/body/B.stories.tsx b/src/stories/typography/body/B.stories.tsx index f73e4c1..4d10ea3 100644 --- a/src/stories/typography/body/B.stories.tsx +++ b/src/stories/typography/body/B.stories.tsx @@ -9,7 +9,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/body/Caption.stories.tsx b/src/stories/typography/body/Caption.stories.tsx index e379d9e..54a527a 100644 --- a/src/stories/typography/body/Caption.stories.tsx +++ b/src/stories/typography/body/Caption.stories.tsx @@ -9,8 +9,11 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); export const Example = Template.bind({}); +Example.args = { + $medium: true, +}; diff --git a/src/stories/typography/body/Lead.stories.tsx b/src/stories/typography/body/Lead.stories.tsx index e1a5b05..decb51a 100644 --- a/src/stories/typography/body/Lead.stories.tsx +++ b/src/stories/typography/body/Lead.stories.tsx @@ -9,7 +9,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/body/P.stories.tsx b/src/stories/typography/body/P.stories.tsx index ae52382..bede8ad 100644 --- a/src/stories/typography/body/P.stories.tsx +++ b/src/stories/typography/body/P.stories.tsx @@ -9,7 +9,7 @@ export default { const Template: ComponentStory = args => (

- {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'}

); diff --git a/src/stories/typography/body/SemiTitle.stories.tsx b/src/stories/typography/body/SemiTitle.stories.tsx index a3d0798..d8710ac 100644 --- a/src/stories/typography/body/SemiTitle.stories.tsx +++ b/src/stories/typography/body/SemiTitle.stories.tsx @@ -9,7 +9,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/body/Subline.stories.tsx b/src/stories/typography/body/Subline.stories.tsx index a014175..685722d 100644 --- a/src/stories/typography/body/Subline.stories.tsx +++ b/src/stories/typography/body/Subline.stories.tsx @@ -9,7 +9,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/body/SublineBold.stories.tsx b/src/stories/typography/body/SublineBold.stories.tsx index 085b653..033cb3b 100644 --- a/src/stories/typography/body/SublineBold.stories.tsx +++ b/src/stories/typography/body/SublineBold.stories.tsx @@ -9,7 +9,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/body/Title.stories.tsx b/src/stories/typography/body/Title.stories.tsx index a35481d..4ce8590 100644 --- a/src/stories/typography/body/Title.stories.tsx +++ b/src/stories/typography/body/Title.stories.tsx @@ -9,7 +9,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/displays/D1.stories.tsx b/src/stories/typography/displays/D1.stories.tsx index ef9108a..2a0a690 100644 --- a/src/stories/typography/displays/D1.stories.tsx +++ b/src/stories/typography/displays/D1.stories.tsx @@ -10,7 +10,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/displays/D2.stories.tsx b/src/stories/typography/displays/D2.stories.tsx index 8c272b3..9603952 100644 --- a/src/stories/typography/displays/D2.stories.tsx +++ b/src/stories/typography/displays/D2.stories.tsx @@ -10,7 +10,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/displays/D3.stories.tsx b/src/stories/typography/displays/D3.stories.tsx index 4d10a22..c881d23 100644 --- a/src/stories/typography/displays/D3.stories.tsx +++ b/src/stories/typography/displays/D3.stories.tsx @@ -10,7 +10,7 @@ export default { const Template: ComponentStory = args => ( - {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'} ); diff --git a/src/stories/typography/headings/H1.stories.tsx b/src/stories/typography/headings/H1.stories.tsx index a1f429b..c451cce 100644 --- a/src/stories/typography/headings/H1.stories.tsx +++ b/src/stories/typography/headings/H1.stories.tsx @@ -16,7 +16,7 @@ export default { // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args const Template: ComponentStory = args => (

- {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'}

); diff --git a/src/stories/typography/headings/H2.stories.tsx b/src/stories/typography/headings/H2.stories.tsx index fbb9f5e..a43928d 100644 --- a/src/stories/typography/headings/H2.stories.tsx +++ b/src/stories/typography/headings/H2.stories.tsx @@ -13,7 +13,7 @@ export default { const Template: ComponentStory = args => (

- {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'}

); diff --git a/src/stories/typography/headings/H3.stories.tsx b/src/stories/typography/headings/H3.stories.tsx index 38bf86d..849a128 100644 --- a/src/stories/typography/headings/H3.stories.tsx +++ b/src/stories/typography/headings/H3.stories.tsx @@ -13,7 +13,7 @@ export default { const Template: ComponentStory = args => (

- {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'}

); diff --git a/src/stories/typography/headings/H4.stories.tsx b/src/stories/typography/headings/H4.stories.tsx index 0e3529b..a5433cc 100644 --- a/src/stories/typography/headings/H4.stories.tsx +++ b/src/stories/typography/headings/H4.stories.tsx @@ -13,7 +13,7 @@ export default { const Template: ComponentStory = args => (

- {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'}

); diff --git a/src/stories/typography/headings/H5.stories.tsx b/src/stories/typography/headings/H5.stories.tsx index c56c864..6c154bc 100644 --- a/src/stories/typography/headings/H5.stories.tsx +++ b/src/stories/typography/headings/H5.stories.tsx @@ -13,7 +13,7 @@ export default { const Template: ComponentStory = args => (
- {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'}
); diff --git a/src/stories/typography/headings/H6.stories.tsx b/src/stories/typography/headings/H6.stories.tsx index 77faf2c..46bdf05 100644 --- a/src/stories/typography/headings/H6.stories.tsx +++ b/src/stories/typography/headings/H6.stories.tsx @@ -13,7 +13,7 @@ export default { const Template: ComponentStory = args => (
- {args.label || 'Was he a beast if music could move him so?'} + {args.title || 'Was he a beast if music could move him so?'}
);