Skip to content

Commit

Permalink
feat(NavigationBar, FunnelNavigationBar, MainNavigationBar): add alte…
Browse files Browse the repository at this point in the history
…rnative variant (#1200)
  • Loading branch information
marcoskolodny authored Aug 21, 2024
1 parent 447a677 commit eef87ec
Show file tree
Hide file tree
Showing 49 changed files with 132 additions and 59 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
88 changes: 50 additions & 38 deletions src/__screenshot_tests__/navigation-bar-screenshot-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import {openStoryPage, screen} from '../test-utils';
const DEVICES = ['MOBILE_IOS', 'DESKTOP'] as const;

test.each`
inverse | isDarkMode
${false} | ${false}
${false} | ${true}
${true} | ${false}
${true} | ${true}
`('MainNavigationBar desktop. inverse={$inverse} isDarkMode={$isDarkMode}', async ({inverse, isDarkMode}) => {
variant | isDarkMode
${'default'} | ${false}
${'default'} | ${true}
${'inverse'} | ${false}
${'inverse'} | ${true}
${'alternative'} | ${false}
${'alternative'} | ${true}
`('MainNavigationBar desktop. variant={$variant} isDarkMode={$isDarkMode}', async ({variant, isDarkMode}) => {
const page = await openStoryPage({
id: 'components-navigation-bars-mainnavigationbar--default',
device: 'DESKTOP',
args: {inverse},
args: {variant},
isDarkMode,
});

Expand All @@ -22,16 +24,18 @@ test.each`
});

test.each`
inverse | isDarkMode
${false} | ${false}
${false} | ${true}
${true} | ${false}
${true} | ${true}
`('MainNavigationBar mobile. inverse={$inverse} isDarkMode={$isDarkMode}', async ({inverse, isDarkMode}) => {
variant | isDarkMode
${'default'} | ${false}
${'default'} | ${true}
${'inverse'} | ${false}
${'inverse'} | ${true}
${'alternative'} | ${false}
${'alternative'} | ${true}
`('MainNavigationBar mobile. variant={$variant} isDarkMode={$isDarkMode}', async ({variant, isDarkMode}) => {
const page = await openStoryPage({
id: 'components-navigation-bars-mainnavigationbar--default',
device: 'MOBILE_IOS',
args: {inverse},
args: {variant},
isDarkMode,
});

Expand Down Expand Up @@ -70,22 +74,26 @@ test('MainNavigationBar large', async () => {
});

test.each`
inverse | isDarkMode | device
${false} | ${false} | ${'DESKTOP'}
${false} | ${true} | ${'DESKTOP'}
${true} | ${false} | ${'DESKTOP'}
${true} | ${true} | ${'DESKTOP'}
${false} | ${false} | ${'MOBILE_IOS'}
${false} | ${true} | ${'MOBILE_IOS'}
${true} | ${false} | ${'MOBILE_IOS'}
${true} | ${true} | ${'MOBILE_IOS'}
variant | isDarkMode | device
${'default'} | ${false} | ${'DESKTOP'}
${'default'} | ${true} | ${'DESKTOP'}
${'inverse'} | ${false} | ${'DESKTOP'}
${'inverse'} | ${true} | ${'DESKTOP'}
${'alternative'} | ${false} | ${'DESKTOP'}
${'alternative'} | ${true} | ${'DESKTOP'}
${'default'} | ${false} | ${'MOBILE_IOS'}
${'default'} | ${true} | ${'MOBILE_IOS'}
${'inverse'} | ${false} | ${'MOBILE_IOS'}
${'inverse'} | ${true} | ${'MOBILE_IOS'}
${'alternative'} | ${false} | ${'MOBILE_IOS'}
${'alternative'} | ${true} | ${'MOBILE_IOS'}
`(
'NavigationBar. inverse={$inverse} isDarkMode={$isDarkMode} device={$device}',
async ({inverse, isDarkMode, device}) => {
'NavigationBar. variant={$variant} isDarkMode={$isDarkMode} device={$device}',
async ({variant, isDarkMode, device}) => {
const page = await openStoryPage({
id: 'components-navigation-bars-navigationbar--default',
device,
args: {inverse},
args: {variant},
isDarkMode,
});

Expand All @@ -96,22 +104,26 @@ test.each`
);

test.each`
inverse | isDarkMode | device
${false} | ${false} | ${'DESKTOP'}
${false} | ${true} | ${'DESKTOP'}
${true} | ${false} | ${'DESKTOP'}
${true} | ${true} | ${'DESKTOP'}
${false} | ${false} | ${'MOBILE_IOS'}
${false} | ${true} | ${'MOBILE_IOS'}
${true} | ${false} | ${'MOBILE_IOS'}
${true} | ${true} | ${'MOBILE_IOS'}
variant | isDarkMode | device
${'default'} | ${false} | ${'DESKTOP'}
${'default'} | ${true} | ${'DESKTOP'}
${'inverse'} | ${false} | ${'DESKTOP'}
${'inverse'} | ${true} | ${'DESKTOP'}
${'alternative'} | ${false} | ${'DESKTOP'}
${'alternative'} | ${true} | ${'DESKTOP'}
${'default'} | ${false} | ${'MOBILE_IOS'}
${'default'} | ${true} | ${'MOBILE_IOS'}
${'inverse'} | ${false} | ${'MOBILE_IOS'}
${'inverse'} | ${true} | ${'MOBILE_IOS'}
${'alternative'} | ${false} | ${'MOBILE_IOS'}
${'alternative'} | ${true} | ${'MOBILE_IOS'}
`(
'FunnelNavigationBar. inverse={$inverse} isDarkMode={$isDarkMode} device={$device}',
async ({inverse, isDarkMode, device}) => {
'FunnelNavigationBar. variant={$variant} isDarkMode={$isDarkMode} device={$device}',
async ({variant, isDarkMode, device}) => {
const page = await openStoryPage({
id: 'components-navigation-bars-funnelnavigationbar--default',
device,
args: {inverse},
args: {variant},
isDarkMode,
});

Expand Down
17 changes: 13 additions & 4 deletions src/__stories__/funnel-navigation-bar-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
} from '..';
import {vars} from '../skins/skin-contract.css';

import type {Variant} from '../theme-variant-context';

export default {
title: 'Components/Navigation bars/FunnelNavigationBar',
component: FunnelNavigationBar,
Expand All @@ -18,14 +20,14 @@ export default {
},
};

type Args = {inverse: boolean; withBorder: boolean};
type Args = {variant: Variant; withBorder: boolean};

export const Default: StoryComponent<Args> = ({inverse, withBorder}) => {
export const Default: StoryComponent<Args> = ({variant, withBorder}) => {
const {isDesktopOrBigger} = useScreenSize();
return (
<FunnelNavigationBar
withBorder={withBorder}
isInverse={inverse}
variant={variant}
right={
<NavigationBarActionGroup>
<NavigationBarAction aria-label="need help?" href="/help">
Expand All @@ -49,6 +51,13 @@ export const Default: StoryComponent<Args> = ({inverse, withBorder}) => {
Default.storyName = 'FunnelNavigationBar';

Default.args = {
inverse: false,
variant: 'default',
withBorder: true,
};

Default.argTypes = {
variant: {
options: ['default', 'inverse', 'alternative'],
control: {type: 'select'},
},
};
17 changes: 13 additions & 4 deletions src/__stories__/main-navigation-bar-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
} from '..';
import avatarImg from './images/avatar.jpg';

import type {Variant} from '../theme-variant-context';

export default {
title: 'Components/Navigation bars/MainNavigationBar',
component: MainNavigationBar,
Expand All @@ -22,15 +24,15 @@ export default {
const sections = ['Start', 'Account', 'Explore', 'Support'];

type Args = {
inverse: boolean;
variant: Variant;
withBorder: boolean;
withBurgerMenuExtra: boolean;
large: boolean;
withSections: boolean;
};

export const Default: StoryComponent<Args> = ({
inverse,
variant,
withBorder,
withBurgerMenuExtra,
large,
Expand All @@ -40,7 +42,7 @@ export const Default: StoryComponent<Args> = ({
const {isDesktopOrBigger} = useScreenSize();
return (
<MainNavigationBar
isInverse={inverse}
variant={variant}
large={large}
withBorder={withBorder}
burgerMenuExtra={withBurgerMenuExtra ? <Placeholder /> : undefined}
Expand Down Expand Up @@ -70,9 +72,16 @@ export const Default: StoryComponent<Args> = ({
Default.storyName = 'MainNavigationBar';

Default.args = {
inverse: false,
variant: 'default',
withBorder: true,
withBurgerMenuExtra: false,
large: false,
withSections: true,
};

Default.argTypes = {
variant: {
options: ['default', 'inverse', 'alternative'],
control: {type: 'select'},
},
};
17 changes: 13 additions & 4 deletions src/__stories__/navigation-bar-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
IconSearchRegular,
} from '..';

import type {Variant} from '../theme-variant-context';

export default {
title: 'Components/Navigation bars/NavigationBar',
component: NavigationBar,
Expand All @@ -15,14 +17,14 @@ export default {
},
};

type Args = {isInverse: boolean; withBorder: boolean};
type Args = {variant: Variant; withBorder: boolean};

export const Default: StoryComponent<Args> = ({isInverse, withBorder}) => {
export const Default: StoryComponent<Args> = ({variant, withBorder}) => {
const {isDesktopOrBigger} = useScreenSize();
return (
<NavigationBar
withBorder={withBorder}
isInverse={isInverse}
variant={variant}
onBack={() => {}}
title="Settings"
right={
Expand All @@ -40,6 +42,13 @@ export const Default: StoryComponent<Args> = ({isInverse, withBorder}) => {
Default.storyName = 'NavigationBar';

Default.args = {
isInverse: false,
variant: 'default',
withBorder: true,
};

Default.argTypes = {
variant: {
options: ['default', 'inverse', 'alternative'],
control: {type: 'select'},
},
};
Loading

1 comment on commit eef87ec

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for mistica-web ready!

✅ Preview
https://mistica-heufwjj0v-flows-projects-65bb050e.vercel.app

Built with commit eef87ec.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.