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

test(components-react): add visual baselines for alert & link #345

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/storybook/src/react-components/alert/alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { LuxAlert, type LuxAlertProps, LuxHeading1, LuxParagraph } from '@lux-design-system/components-react';
import tokens from '@lux-design-system/design-tokens/dist/index.json';
import type { Meta, StoryObj } from '@storybook/react';
import { VisualTypes } from './visual/Types';
import { createVisualRegressionStory, VisualRegressionWrapper } from '../../utils';

type Story = StoryObj<typeof meta>;

const meta = {
title: 'React Components/Alert',
id: 'react-components-alert',
component: LuxAlert,
subcomponents: {},
parameters: {
tokens,
tokensPrefix: 'utrecht-alert',
Expand Down Expand Up @@ -112,3 +113,16 @@ export const ErrorAlert: Story = {
},
},
};

export const Visual = createVisualRegressionStory(() => (
<>
<h4 className="utrecht-heading-3">Light</h4>
<VisualRegressionWrapper className={`lux-theme--logius-light`}>
<VisualTypes />
</VisualRegressionWrapper>
<h4 className="utrecht-heading-3">Dark</h4>
<VisualRegressionWrapper className={`lux-theme--logius-dark`}>
<VisualTypes />
</VisualRegressionWrapper>
</>
));
17 changes: 17 additions & 0 deletions packages/storybook/src/react-components/alert/visual/Types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LuxAlert, LuxAlertProps, LuxParagraph } from '@lux-design-system/components-react';
import { PropsWithChildren } from 'react';

const VisualAlertTemplate = ({ children, type }: PropsWithChildren<LuxAlertProps>) => (
<LuxAlert type={type}>
<LuxParagraph>{children}</LuxParagraph>
</LuxAlert>
);

export const VisualTypes = () => (
<>
<VisualAlertTemplate type="info">Info Alert</VisualAlertTemplate>
<VisualAlertTemplate type="success">Okay Alert</VisualAlertTemplate>
<VisualAlertTemplate type="warning">Warning Alert</VisualAlertTemplate>
<VisualAlertTemplate type="error">Error Alert</VisualAlertTemplate>
</>
);
15 changes: 15 additions & 0 deletions packages/storybook/src/react-components/link/link.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { LuxLink } from '@lux-design-system/components-react';
import tokens from '@lux-design-system/design-tokens/dist/index.json';
import type { Meta, StoryObj } from '@storybook/react';
import { VisualStates } from './visual/States';
import { createVisualRegressionStory, VisualRegressionWrapper } from '../../utils';

type Story = StoryObj<typeof meta>;

Expand Down Expand Up @@ -204,3 +206,16 @@ export const LinkWithIconEnd: Story = {
},
},
};

export const Visual = createVisualRegressionStory(() => (
<>
<h4 className="utrecht-heading-3">Light</h4>
<VisualRegressionWrapper className={`lux-theme--logius-light`}>
<VisualStates />
</VisualRegressionWrapper>
<h4 className="utrecht-heading-3">Dark</h4>
<VisualRegressionWrapper className={`lux-theme--logius-dark`}>
<VisualStates />
</VisualRegressionWrapper>
</>
));
22 changes: 22 additions & 0 deletions packages/storybook/src/react-components/link/visual/States.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { LuxLink } from '@lux-design-system/components-react';

export const VisualStates = () => (
<div className="utrecht-document">
MrSkippy marked this conversation as resolved.
Show resolved Hide resolved
<LuxLink href="#">Link</LuxLink>
<div className="pseudo-hover-all">
<LuxLink href="#">Hover link</LuxLink>
</div>
<div className="pseudo-active-all">
<LuxLink href="#">Active link</LuxLink>
</div>
<div className="pseudo-visited-all">
<LuxLink href="#">Visited link</LuxLink>
</div>
<div className="pseudo-focus-all">
<LuxLink href="#">Focus link</LuxLink>
</div>
<div className="pseudo-focus-visible-all">
<LuxLink href="#">Focus visible link</LuxLink>
</div>
</div>
);
Loading