-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11564 from storybookjs/fix/color-border-in-menu
FIX the color of the menu separator
- Loading branch information
Showing
3 changed files
with
65 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,64 @@ | ||
import React from 'react'; | ||
import React, { Fragment, FunctionComponent } from 'react'; | ||
|
||
import { TooltipLinkList } from '@storybook/components'; | ||
import { MenuItemIcon } from './Menu'; | ||
import { WithTooltip, TooltipLinkList, Icons } from '@storybook/components'; | ||
import { styled } from '@storybook/theming'; | ||
import { MenuItemIcon, SidebarMenu, MenuButton, SidebarMenuList } from './Menu'; | ||
import { useMenu } from '../../containers/menu'; | ||
|
||
export default { | ||
component: MenuItemIcon, | ||
title: 'UI/Sidebar/Menu', | ||
decorators: [ | ||
(StoryFn: FunctionComponent) => ( | ||
<Fragment> | ||
<StoryFn /> | ||
</Fragment> | ||
), | ||
], | ||
}; | ||
|
||
export const all = () => ( | ||
<TooltipLinkList | ||
links={[ | ||
{ title: 'has icon', left: <MenuItemIcon icon="check" />, id: 'icon' }, | ||
{ | ||
title: 'has imgSrc', | ||
left: <MenuItemIcon imgSrc="https://via.placeholder.com/20" />, | ||
id: 'img', | ||
}, | ||
{ title: 'has neither', left: <MenuItemIcon />, id: 'non' }, | ||
]} | ||
/> | ||
); | ||
const fakemenu = [ | ||
{ title: 'has icon', left: <MenuItemIcon icon="check" />, id: 'icon' }, | ||
{ | ||
title: 'has imgSrc', | ||
left: <MenuItemIcon imgSrc="https://via.placeholder.com/20" />, | ||
id: 'img', | ||
}, | ||
{ title: 'has neither', left: <MenuItemIcon />, id: 'non' }, | ||
]; | ||
|
||
export const Items = () => <TooltipLinkList links={fakemenu} />; | ||
|
||
export const Real = () => <SidebarMenu menu={fakemenu} isHighlighted />; | ||
|
||
const DoubleThemeRenderingHack = styled.div({ | ||
'#root > div:first-child > &': { | ||
textAlign: 'right', | ||
}, | ||
}); | ||
|
||
export const Expanded = () => { | ||
const menu = useMenu( | ||
// @ts-ignore | ||
{ getShortcutKeys: () => ({}), versionUpdateAvailable: () => false }, | ||
false, | ||
false, | ||
false, | ||
false | ||
); | ||
return ( | ||
<DoubleThemeRenderingHack> | ||
<WithTooltip | ||
placement="top" | ||
trigger="click" | ||
closeOnClick | ||
startOpen | ||
tooltip={({ onHide }) => <SidebarMenuList onHide={onHide} menu={menu} />} | ||
> | ||
<MenuButton outline small containsIcon highlighted={false} title="Shortcuts"> | ||
<Icons icon="ellipsis" /> | ||
</MenuButton> | ||
</WithTooltip> | ||
</DoubleThemeRenderingHack> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters