diff --git a/ui/src/components/card/card.styles.ts b/ui/src/components/card/card.styles.ts new file mode 100644 index 0000000..085bc7a --- /dev/null +++ b/ui/src/components/card/card.styles.ts @@ -0,0 +1,35 @@ +import { dripStitches } from '@/theme'; + +const { styled } = dripStitches; + +export abstract class CardStyles { + static readonly Container = styled('div', { + backgroundColor: '$slate2', + borderRadius: '$xlh', + padding: '$7', + borderStyle: 'solid', + borderColor: '$slate6', + borderWidth: '$default', + }); + + static readonly Heading = styled('h3', { + color: '$slate12', + fontSize: '$xl', + fontWeight: '$medium', + }); + + static readonly Body = styled('div', { + pt: '$5', + }); + + static readonly Text = styled('div', { + backgroundColor: '$slate1', + borderRadius: '$xl', + display: 'flex', + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + textAlign: 'center', + color: '$slate8', + }); +} diff --git a/ui/src/components/card/card.tsx b/ui/src/components/card/card.tsx new file mode 100644 index 0000000..fbd992a --- /dev/null +++ b/ui/src/components/card/card.tsx @@ -0,0 +1,67 @@ +import React, { forwardRef } from 'react'; +import { Flex } from '../layout'; +import { CardStyles } from './card.styles'; + +export abstract class Card { + static readonly Container = forwardRef( + ({ children, ...props }, ref) => { + return ( + + {children} + + ); + } + ); + + static readonly Heading = forwardRef( + ({ title, leftIcon, rightIcon, ...props }, ref) => { + return ( + + + {leftIcon} + + {title} + + + {rightIcon} + + ); + } + ); + + static readonly Body = forwardRef( + ({ children, ...props }, ref) => { + return ( + + {children} + + ); + } + ); + + static readonly Text = forwardRef( + ({ children, ...props }, ref) => { + return ( + + {children} + + ); + } + ); +} + +export namespace Card { + export type ContainerProps = React.ComponentProps< + typeof CardStyles.Container + >; + + export type HeadingProps = { + title: string; + leftIcon?: React.ReactNode; + rightIcon?: React.ReactNode; + } & React.ComponentProps; + + export type BodyProps = React.ComponentProps; + + export type CardTextProps = React.ComponentProps; +} diff --git a/ui/src/components/card/index.ts b/ui/src/components/card/index.ts new file mode 100644 index 0000000..1e13f64 --- /dev/null +++ b/ui/src/components/card/index.ts @@ -0,0 +1 @@ +export * from './card'; diff --git a/ui/src/components/core/icon/icon-library.tsx b/ui/src/components/core/icon/icon-library.tsx index 5b219c2..cc9bddb 100644 --- a/ui/src/components/core/icon/icon-library.tsx +++ b/ui/src/components/core/icon/icon-library.tsx @@ -4,6 +4,7 @@ import { IoInformationCircleSharp } from '@react-icons/all-files/io5/IoInformati import { IoCloudUploadSharp } from '@react-icons/all-files/io5/IoCloudUploadSharp'; import { AiOutlineCheck } from '@react-icons/all-files/ai/AiOutlineCheck'; import { MetamaskIcon, EthereumIcon } from './custom'; +import { BiSearch } from '@react-icons/all-files/bi/BiSearch'; export const IconLibrary = Object.freeze({ back: IoArrowBackCircleSharp, @@ -13,8 +14,9 @@ export const IconLibrary = Object.freeze({ info: IoInformationCircleSharp, upload: IoCloudUploadSharp, metamask: MetamaskIcon, //remove if not used + search: BiSearch, }); export type IconName = keyof typeof IconLibrary; -export type IconType = typeof IconLibrary[Name]; +export type IconType = (typeof IconLibrary)[Name]; diff --git a/ui/src/components/core/input/index.ts b/ui/src/components/core/input/index.ts index fa78574..133d7ec 100644 --- a/ui/src/components/core/input/index.ts +++ b/ui/src/components/core/input/index.ts @@ -1 +1,2 @@ export * from './input'; +export * from './input.styles'; diff --git a/ui/src/components/core/input/input.ts b/ui/src/components/core/input/input.styles.ts similarity index 72% rename from ui/src/components/core/input/input.ts rename to ui/src/components/core/input/input.styles.ts index 3ff8e4d..9ae81f4 100644 --- a/ui/src/components/core/input/input.ts +++ b/ui/src/components/core/input/input.styles.ts @@ -1,5 +1,5 @@ -import { dripStitches } from '../../../theme'; -import { StyledInputFile } from './input-file'; +import { dripStitches } from '@/theme'; +import { Icon } from '../icon'; const { styled } = dripStitches; const styles = { @@ -9,7 +9,6 @@ const styles = { borderStyle: 'solid', minWidth: '$0', color: '$slate12', - my: '$1h', transition: 'border-color 0.2s ease-in-out', borderWidth: '$default', @@ -45,6 +44,7 @@ const styles = { md: { borderRadius: '$lg', fontSize: '$sm', + height: '$11', p: '$3 $3h', }, lg: { @@ -59,8 +59,13 @@ const styles = { }, }; -export const Input = styled('input', styles); +export const InputStyled = styled('input', styles); -export const Textarea = styled('textarea', styles); +export const InputIconStyled = styled(Icon, { + position: 'absolute', + left: '$4', + top: '0.9375rem', + color: 'slate8', +}); -export const LogoFileInput = StyledInputFile; +export const TextareaStyled = styled('textarea', styles); diff --git a/ui/src/components/core/input/input.tsx b/ui/src/components/core/input/input.tsx new file mode 100644 index 0000000..d50c157 --- /dev/null +++ b/ui/src/components/core/input/input.tsx @@ -0,0 +1,29 @@ +import React, { forwardRef } from 'react'; +import { IconName } from '../icon'; +import { StyledInputFile } from './input-file'; +import { InputIconStyled, InputStyled, TextareaStyled } from './input.styles'; + +export const Textarea = TextareaStyled; + +export const LogoFileInput = StyledInputFile; + +type InputProps = { + leftIcon?: IconName; +} & React.ComponentProps; + +export const Input = forwardRef( + ({ leftIcon, ...props }, ref) => { + return ( +
+ {leftIcon && ( + + )} + +
+ ); + } +); diff --git a/ui/src/components/form/form.styles.ts b/ui/src/components/form/form.styles.ts index f7fb11b..7b47e9a 100644 --- a/ui/src/components/form/form.styles.ts +++ b/ui/src/components/form/form.styles.ts @@ -9,6 +9,7 @@ export abstract class FormStyles { static readonly Label = styled('label', { color: '$slate11', + mb: '$1h', '&:disabled': { color: '$slate8', @@ -34,6 +35,7 @@ export abstract class FormStyles { static readonly ErrorMessage = styled('span', { color: '$red11', fontSize: '0.625rem', + mt: '$1h', variants: { size: { diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts index ac077c2..7a005be 100644 --- a/ui/src/components/index.ts +++ b/ui/src/components/index.ts @@ -1,3 +1,4 @@ export * from './core'; export * from './layout'; export * from './form'; +export * from './card';