diff --git a/src/design-system/settings/setting.component.tsx b/src/design-system/settings/setting.component.tsx new file mode 100644 index 0000000..a154f93 --- /dev/null +++ b/src/design-system/settings/setting.component.tsx @@ -0,0 +1,50 @@ +import React, { ReactNode } from 'react'; + +import { Box } from '../box'; +import { Flex } from '../flex'; +import { Text } from '../text'; + +import * as styles from './setting.css'; + +interface SettingsItemProps { + addon?: ReactNode; + description: ReactNode; + onClick?: () => void; + testId?: string; + title?: ReactNode | string; +} + +export const Setting = ({ + description, + addon, + onClick, + testId = 'setting', + title, +}: SettingsItemProps): React.ReactElement => ( + +
+ + {title ? ( + + + {title} + + + ) : null} + + + {description} + +
{addon}
+
+
+ +); diff --git a/src/design-system/settings/setting.css.ts b/src/design-system/settings/setting.css.ts new file mode 100644 index 0000000..7886b39 --- /dev/null +++ b/src/design-system/settings/setting.css.ts @@ -0,0 +1,27 @@ +import { style, vars } from '../../design-tokens'; + +export const root = style({}); + +export const separator = style({ + width: '100%', + height: 1, + background: vars.colors.$settings_item_separator_color, + selectors: { + [`${root}:first-of-type &`]: { + background: 'none', + }, + [`${root}:hover &`]: { + background: 'none', + }, + }, +}); + +export const content = style({ + selectors: { + '&:hover': { + background: vars.colors.$settings_item_hover_bgColor, + borderRadius: vars.spacing.$16, + cursor: 'pointer', + }, + }, +}); diff --git a/src/design-system/settings/settings-section.component.tsx b/src/design-system/settings/settings-section.component.tsx new file mode 100644 index 0000000..7dce3a6 --- /dev/null +++ b/src/design-system/settings/settings-section.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; + +import { Box } from '../box'; +import { Text } from '../text'; + +import * as styles from './settings-section.css'; + +interface SettingsCardProps { + title: string; + testId?: string; + children: React.ReactNode; +} + +export const SettingsSection = ({ + children, + title, + testId = 'settings-section', +}: SettingsCardProps): React.ReactElement => ( +
+ + + {title} + + +
{children}
+
+); diff --git a/src/design-system/settings/settings-section.css.ts b/src/design-system/settings/settings-section.css.ts new file mode 100644 index 0000000..bd8e5a4 --- /dev/null +++ b/src/design-system/settings/settings-section.css.ts @@ -0,0 +1,8 @@ +import { style, vars } from '../../design-tokens'; + +export const root = style([ + { + width: vars.spacing.$fill, + marginBottom: vars.spacing.$40, + }, +]); diff --git a/src/design-system/settings/settings.stories.tsx b/src/design-system/settings/settings.stories.tsx new file mode 100644 index 0000000..66f2c26 --- /dev/null +++ b/src/design-system/settings/settings.stories.tsx @@ -0,0 +1,56 @@ +import React from 'react'; + +import { action } from '@storybook/addon-actions'; +import type { Meta } from '@storybook/react'; + +import * as Button from '../buttons/'; +import { page, Section, Variants } from '../decorators'; +import { Flex } from '../flex'; +import { Grid, Cell } from '../grid'; + +import { Setting } from './setting.component'; +import { SettingsSection } from './settings-section.component'; + +export default { + title: 'Settings/Overview', + + decorators: [ + page({ + title: 'Settings Components', + subtitle: + 'These components can be used to render the sections and items on a settings page.', + }), + ], +} as Meta; + +export const Overview = (): React.JSX.Element => ( +
+ + +
+ + + + + + + } + /> + + + + + +
+
+
+
+); diff --git a/src/design-tokens/colors.data.ts b/src/design-tokens/colors.data.ts index 554049b..a80205a 100644 --- a/src/design-tokens/colors.data.ts +++ b/src/design-tokens/colors.data.ts @@ -295,6 +295,9 @@ export const colors = { $address_tag_own_bgColor: '', $address_tag_foreign_color: '', $address_tag_foreign_bgColor: '', + + $settings_item_separator_color: '', + $settings_item_hover_bgColor: '', }; export type Colors = typeof colors; diff --git a/src/design-tokens/theme/dark-theme.css.ts b/src/design-tokens/theme/dark-theme.css.ts index 38d3061..09b9c8b 100644 --- a/src/design-tokens/theme/dark-theme.css.ts +++ b/src/design-tokens/theme/dark-theme.css.ts @@ -394,6 +394,9 @@ const colors: Colors = { darkColorScheme.$primary_accent_purple, 0.1, ), + + $settings_item_separator_color: darkColorScheme.$primary_mid_grey, + $settings_item_hover_bgColor: darkColorScheme.$primary_mid_grey, }; const elevation: Elevation = { diff --git a/src/design-tokens/theme/light-theme.css.ts b/src/design-tokens/theme/light-theme.css.ts index 0ed7555..b92618c 100644 --- a/src/design-tokens/theme/light-theme.css.ts +++ b/src/design-tokens/theme/light-theme.css.ts @@ -422,6 +422,9 @@ const colors: Colors = { lightColorScheme.$primary_accent_purple, 0.1, ), + + $settings_item_separator_color: lightColorScheme.$primary_light_grey_plus, + $settings_item_hover_bgColor: lightColorScheme.$primary_light_grey, }; export const elevation: Elevation = {