Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: menu component token #43576

Merged
merged 9 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions .dumi/theme/slots/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ const Sidebar: React.FC = () => {
} = useSiteToken();

const menuChild = (
<ConfigProvider theme={{ components: { Menu: { itemBg: colorBgContainer } } }}>
<ConfigProvider
theme={{ components: { Menu: { itemBg: colorBgContainer, darkItemBg: colorBgContainer } } }}
>
<Menu
items={menuItems}
inlineIndent={30}
css={styles.asideContainer}
mode="inline"
mode='inline'
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
theme={isDark ? 'dark' : 'light'}
selectedKeys={[selectedKey]}
defaultOpenKeys={sidebarData?.map(({ title }) => title).filter((item) => item) as string[]}
Expand All @@ -148,10 +150,10 @@ const Sidebar: React.FC = () => {
);

return isMobile ? (
<MobileMenu key="Mobile-menu">{menuChild}</MobileMenu>
<MobileMenu key='Mobile-menu'>{menuChild}</MobileMenu>
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
) : (
<Col xxl={4} xl={5} lg={6} md={6} sm={24} xs={24} css={styles.mainMenu}>
<section className="main-menu-inner">{menuChild}</section>
<section className='main-menu-inner'>{menuChild}</section>
li-jia-nan marked this conversation as resolved.
Show resolved Hide resolved
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
</Col>
);
};
Expand Down
6 changes: 2 additions & 4 deletions components/layout/__tests__/token.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ describe('Layout.Token', () => {
>
<Header>
<Menu
theme="dark"
mode="horizontal"
mode='horizontal'
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
defaultSelectedKeys={['2']}
items={new Array(15).fill(null).map((_, index) => {
const key = index + 1;
Expand Down Expand Up @@ -62,8 +61,7 @@ describe('Layout.Token', () => {
>
<Header>
<Menu
theme="dark"
mode="horizontal"
mode='horizontal'
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
defaultSelectedKeys={['2']}
items={new Array(15).fill(null).map((_, index) => {
const key = index + 1;
Expand Down