Skip to content

Commit

Permalink
fix: fixed several minor naming problems and the Tabs mark in AppLayo…
Browse files Browse the repository at this point in the history
…ut story for secondary navigation
  • Loading branch information
soslayando committed Sep 23, 2024
1 parent cd81b03 commit 85e5699
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 35 deletions.
74 changes: 48 additions & 26 deletions packages/core/src/components/AppLayout/AppLayout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';

import { AppLayout } from './AppLayout';
import { AppBar } from '../AppBar';
import { Tabs } from '../Tabs';
import { Tabs, useTabsAccessibility } from '../Tabs';
import { Panel } from '../Panel';
import { Typography } from '../Typography';
import { TabsCmp } from './__stories__';
Expand Down Expand Up @@ -43,31 +43,53 @@ export const Base: Story = {

export const DoubleNavigation: Story = {
tags: ['isHidden'],
render: () => (
<AppLayout>
<AppLayout.Bar>
<AppBar>
<AppBar.Heading id="bar-heading">Title</AppBar.Heading>
<AppBar.Divider />
<AppBar.Navigation id="bar-navigation">
<TabsCmp />
</AppBar.Navigation>
</AppBar>
</AppLayout.Bar>
<AppLayout.Lead>
<Tabs contained>
<Tabs.Item size="sm" state={'selected'} label="Subitem 1" />
<Tabs.Item size="sm" label="Subitem 2" />
<Tabs.Item size="sm" label="Subitem 3" />
</Tabs>
</AppLayout.Lead>
<AppLayout.Content>
<Panel height="100%">
<Panel.Body>Content</Panel.Body>
</Panel>
</AppLayout.Content>
</AppLayout>
),
render: () => {
const tabsRef = React.useRef<HTMLDivElement>();
const [activeTab, setActiveTab] = React.useState(0);
useTabsAccessibility({ activeTab, tabsRef });
return (
<AppLayout>
<AppLayout.Bar>
<AppBar>
<AppBar.Heading id="bar-heading">Title</AppBar.Heading>
<AppBar.Divider />
<AppBar.Navigation id="bar-navigation">
<TabsCmp />
</AppBar.Navigation>
</AppBar>
</AppLayout.Bar>
<AppLayout.Lead>
<Tabs contained>
<Tabs.List activeTabIndex={activeTab} ref={tabsRef}>
<Tabs.Item
size="sm"
label="Subitem 1"
onClick={() => setActiveTab(0)}
state={activeTab === 0 ? 'selected' : undefined}
/>
<Tabs.Item
size="sm"
label="Subitem 2"
onClick={() => setActiveTab(0)}
state={activeTab === 1 ? 'selected' : undefined}
/>
<Tabs.Item
size="sm"
label="Subitem 3"
onClick={() => setActiveTab(0)}
state={activeTab === 2 ? 'selected' : undefined}
/>
</Tabs.List>
</Tabs>
</AppLayout.Lead>
<AppLayout.Content>
<Panel height="100%">
<Panel.Body>Content</Panel.Body>
</Panel>
</AppLayout.Content>
</AppLayout>
);
},
};

export const ContentPadding: Story = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const StyledAvatarBackdrop = styled.span<StyledAvatarBackdropProps>`
*:focus > &,
*:focus-visible > & {
box-shadow: ${theme.alias.elevation.boxShadow.base.focused};
box-shadow: ${aliasTokens.elevation.boxShadow.base.focused};
}
`;
}};
Expand Down
14 changes: 9 additions & 5 deletions packages/core/src/components/Avatar/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ export const AVATAR_VARIANT_DEFAULT_VALUE = 'circle';
export const AVATAR_SIZE_BORDER_MAP: {
[key in TAvatarSize]?: string;
} = {
xs: '1px',
sm: '1px',
md: '2px',
lg: '3px',
xl: '4px',
xxxs: '0.1rem',
xxs: '0.1rem',
xs: '0.1rem',
sm: '0.1rem',
md: '0.2rem',
lg: '0.2rem',
xl: '0.3rem',
xxl: '0.3rem',
xxxl: '0.3rem',
};

export const AVATAR_SIZE_SQUARE_MAP: {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/styled/mixins/typography/typoColorMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export const typoColorMixin = ({
$colorScheme?: TTypoColorScheme;
theme: DefaultTheme;
}) => {
const aliasTexColoTokens = tokens.alias.color.text;
const aliasTexColorTokens = tokens.alias.color.text;
const textColorByToken =
aliasTexColoTokens?.[$variant]?.[$colorScheme] ||
getUiTokenValueByColorScheme(aliasTexColoTokens.feedback, $colorScheme);
aliasTexColorTokens?.[$variant]?.[$colorScheme] ||
getUiTokenValueByColorScheme(aliasTexColorTokens.feedback, $colorScheme);
return css`
color: ${isValidColor($colorScheme) ? $colorScheme : textColorByToken};
`;
Expand Down

0 comments on commit 85e5699

Please sign in to comment.