Skip to content

Commit

Permalink
docs: refa theme select as menu
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahgm committed Dec 9, 2022
1 parent 908e8ce commit 789989e
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 92 deletions.
19 changes: 19 additions & 0 deletions docs/src/components/ThemeMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Button, Menu } from '@marigold/components';
import { ChevronDown } from '@marigold/icons';
import { useThemeSwitch } from './ThemeSwitch';

export const ThemeMenu = () => {
const { current, themes, setTheme } = useThemeSwitch();
return (
<Menu.Trigger>
<Button variant="outline">
{current} <ChevronDown />
</Button>
<Menu onSelect={current => setTheme(current)}>
{Object.keys(themes).map(name => (
<Menu.Item key={name}>{name}</Menu.Item>
))}
</Menu>
</Menu.Trigger>
);
};
21 changes: 0 additions & 21 deletions docs/src/components/ThemeSelect.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export * from './Preview';
export * from './PropsTable';
export * from './ScrollToTop';
export * from './Toc';
export * from './ThemeSelect';
export * from './ThemeMenu';
export * from './ThemeSwitch';
export * from './Title';
export * from './Version';
4 changes: 2 additions & 2 deletions docs/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import {
IconLinksList,
GradientHeadline,
ThemeSelect,
ThemeMenu,
Title,
TocContainer,
ScrollToTop,
Expand Down Expand Up @@ -109,7 +109,7 @@ const MyApp = ({ Component, pageProps }: AppProps<PageProps>) => {
<Box css={{ display: 'flex', gap: 'large-2' }}>
<Container contentType="content" size="large">
<Box as={Inline} mb={'small-1'}>
{pageProps?.switchTheme && <ThemeSelect />}
{pageProps?.switchTheme && <ThemeMenu />}
<Split />
{(pageProps?.figma ||
pageProps?.github ||
Expand Down
10 changes: 10 additions & 0 deletions docs/src/theme/components/Button.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const Button: Theme['components']['Button'] = {
variant: {
outline: {
background: 'transparent',
px: 'small-1',
color: 'text.regular',
lineHeight: 'large-2',
borderStyle: 'solid',
borderWidth: 'small-1',
borderRadius: 'small-2',
Expand Down Expand Up @@ -42,6 +45,13 @@ export const Button: Theme['components']['Button'] = {
width: '100%',
height: '100%',
},
menu: {
bg: 'background.light',
borderRadius: 'small-2',
'&:hover': {
bg: 'gray60',
},
},
},
size: {
full: {
Expand Down
33 changes: 0 additions & 33 deletions docs/src/theme/components/ListBox.style.ts

This file was deleted.

22 changes: 22 additions & 0 deletions docs/src/theme/components/Menu.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Theme } from '@marigold/components';

export const Menu: Theme['components']['Menu'] = {
base: {
container: {
bg: 'background.page',
border: '1px solid',
borderColor: 'background.light',
borderRadius: 'small-2',
maxHeight: ['75vh', '75vh', '45vh'],
overflow: 'hidden auto',
},
item: {
p: 'small-1',
cursor: 'pointer',

'&:hover': {
color: 'brand.primary',
},
},
},
};
33 changes: 0 additions & 33 deletions docs/src/theme/components/Select.style.ts

This file was deleted.

3 changes: 1 addition & 2 deletions docs/src/theme/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ export * from './Preview.style';
export * from './Header.style';
export * from './Headline.style';
export * from './Link.style';
export * from './ListBox.style';
export * from './List.style';
export * from './Navigation.style';
export * from './Menu.style';
export * from './Message.style';
export * from './Select.style';
export * from './Text.style';
export * from './Table.style';
export * from './ScrollToTop.style';
Expand Down

0 comments on commit 789989e

Please sign in to comment.