-
Notifications
You must be signed in to change notification settings - Fork 1
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 baseline to all formfield components #347
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import { LuxFormFieldCheckbox, type LuxFormFieldCheckboxProps } from '@lux-desig | |
import tokens from '@lux-design-system/design-tokens/dist/index.json'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { BADGES } from '../../../config/preview'; | ||
import { createDesignTokensStory, createVisualRegressionStory, VisualRegressionWrapper } from '../../utils'; | ||
import CheckboxMeta from '../checkbox/checkbox.stories'; | ||
import FormFieldDescriptionMeta from '../form-field-description/form-field-description.stories'; | ||
import FormFieldErrorMessageMeta from '../form-field-error-message/form-field-error-message.stories'; | ||
|
@@ -105,3 +106,50 @@ export const withLongTexts: Story = { | |
withTarget: true, | ||
}, | ||
}; | ||
|
||
export const DesignTokens = createDesignTokensStory(meta); | ||
|
||
export const Visual = createVisualRegressionStory(() => ( | ||
<> | ||
<h4 className="utrecht-heading-3">Light</h4> | ||
<VisualRegressionWrapper className={`lux-theme--logius-light`}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ik denk dat dit te veel is om bij te houden. Mocht er iets veranderen aan de test moeten we dat handmatig synchroon houden. Liever zie ik een |
||
<LuxFormFieldCheckbox label="Label" /> | ||
<LuxFormFieldCheckbox label="Label" checked /> | ||
<LuxFormFieldCheckbox label="Label" description="Description" /> | ||
<h5 className="utrecht-heading-4">Hover & Focus</h5> | ||
<div className="pseudo-hover-all"> | ||
<LuxFormFieldCheckbox label="Label" /> | ||
</div> | ||
<div className="pseudo-focus-all pseudo-focus-visible-all"> | ||
<LuxFormFieldCheckbox label="Label" /> | ||
</div> | ||
<h5 className="utrecht-heading-4">Invalid</h5> | ||
<LuxFormFieldCheckbox label="Label" errorMessage="Error Message" invalid /> | ||
<LuxFormFieldCheckbox label="Label" description="Description" errorMessage="Error Message" invalid /> | ||
<h5 className="utrecht-heading-4">Disabled</h5> | ||
<LuxFormFieldCheckbox label="Label" disabled /> | ||
<LuxFormFieldCheckbox label="Label" disabled checked /> | ||
<LuxFormFieldCheckbox label="Label" description="Description" disabled /> | ||
</VisualRegressionWrapper> | ||
<h4 className="utrecht-heading-3">Dark</h4> | ||
<VisualRegressionWrapper className={`lux-theme--logius-dark`}> | ||
<LuxFormFieldCheckbox label="Label" /> | ||
<LuxFormFieldCheckbox label="Label" checked /> | ||
<LuxFormFieldCheckbox label="Label" description="Description" /> | ||
<h5 className="utrecht-heading-4">Hover & Focus</h5> | ||
<div className="pseudo-hover-all"> | ||
<LuxFormFieldCheckbox label="Label" /> | ||
</div> | ||
<div className="pseudo-focus-all pseudo-focus-visible-all"> | ||
<LuxFormFieldCheckbox label="Label" /> | ||
</div> | ||
<h5 className="utrecht-heading-4">Invalid</h5> | ||
<LuxFormFieldCheckbox label="Label" errorMessage="Error Message" invalid /> | ||
<LuxFormFieldCheckbox label="Label" description="Description" errorMessage="Error Message" invalid /> | ||
<h5 className="utrecht-heading-4">Disabled</h5> | ||
<LuxFormFieldCheckbox label="Label" disabled /> | ||
<LuxFormFieldCheckbox label="Label" disabled checked /> | ||
<LuxFormFieldCheckbox label="Label" description="Description" disabled /> | ||
</VisualRegressionWrapper> | ||
</> | ||
)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,18 @@ import { LuxFormFieldDescription } 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 { BADGES } from '../../../config/preview'; | ||
import { createDesignTokensStory, createVisualRegressionStory, VisualRegressionWrapper } from '../../utils'; | ||
|
||
const CustomStyleBlock = () => ( | ||
<style> | ||
{` | ||
.lux-theme--logius-custom { | ||
--utrecht-form-field-description-valid-color: green; | ||
--utrecht-form-field-description-invalid-color: red; | ||
} | ||
`} | ||
</style> | ||
); | ||
|
||
const meta = { | ||
title: 'React Components/Form Field/Form Field Description', | ||
|
@@ -10,7 +22,7 @@ const meta = { | |
parameters: { | ||
badges: [BADGES.WIP, BADGES.CANARY], | ||
tokens, | ||
tokensPrefix: 'react-form-field-description', | ||
tokensPrefix: 'utrecht-form-field-description', | ||
docs: { | ||
description: { | ||
component: 'A description component for form fields that provides additional context or validation feedback.', | ||
|
@@ -94,6 +106,35 @@ export const Invalid: Story = { | |
}, | ||
}; | ||
|
||
export const CustomAppearance: Story = { | ||
args: {}, | ||
render: () => ( | ||
<> | ||
<CustomStyleBlock /> | ||
<LuxFormFieldDescription appearance="valid" className={`lux-theme--logius-custom`}> | ||
Valid Form Field Description | ||
</LuxFormFieldDescription> | ||
<LuxFormFieldDescription appearance="invalid" className={`lux-theme--logius-custom`}> | ||
Invalid Form Field Description | ||
</LuxFormFieldDescription> | ||
</> | ||
), | ||
parameters: { | ||
controls: { | ||
disable: true, | ||
}, | ||
docs: { | ||
source: { | ||
code: null, | ||
}, | ||
description: { | ||
story: | ||
'Om de `valid` en `invalid` _appearance_ een styling te geven kan dit met de `...valid.color`- en `...invalid.color`-tokens.', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const LongDescription: Story = { | ||
args: { | ||
children: | ||
|
@@ -107,3 +148,44 @@ export const LongDescription: Story = { | |
}, | ||
}, | ||
}; | ||
|
||
export const DesignTokens = createDesignTokensStory(meta); | ||
|
||
export const Visual = createVisualRegressionStory(() => ( | ||
<> | ||
<h4 className="utrecht-heading-3">Light</h4> | ||
<VisualRegressionWrapper className={`lux-theme--logius-light`}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hier ook graag een |
||
<LuxFormFieldDescription>Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription appearance="valid">Valid Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription appearance="invalid">Invalid Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription> | ||
Long Form Field Description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Dolor ante id varius, | ||
aenean eu faucibus vitae malesuada. Viverra malesuada aliquam et placerat justo porta ipsum parturient. Cursus | ||
nostra varius efficitur lobortis aliquam lectus bibendum. | ||
</LuxFormFieldDescription> | ||
</VisualRegressionWrapper> | ||
<h4 className="utrecht-heading-3">Dark</h4> | ||
<VisualRegressionWrapper className={`lux-theme--logius-dark`}> | ||
<LuxFormFieldDescription>Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription appearance="valid">Valid Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription appearance="invalid">Invalid Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription> | ||
Long Form Field Description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Dolor ante id varius, | ||
aenean eu faucibus vitae malesuada. Viverra malesuada aliquam et placerat justo porta ipsum parturient. Cursus | ||
nostra varius efficitur lobortis aliquam lectus bibendum. | ||
</LuxFormFieldDescription> | ||
</VisualRegressionWrapper> | ||
<h4 className="utrecht-heading-3">Custom</h4> | ||
<CustomStyleBlock /> | ||
<VisualRegressionWrapper className={`lux-theme--logius-light lux-theme--logius-custom`}> | ||
<LuxFormFieldDescription>Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription appearance="valid">Valid Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription appearance="invalid">Invalid Form Field Description</LuxFormFieldDescription> | ||
<LuxFormFieldDescription> | ||
Long Form Field Description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Dolor ante id varius, | ||
aenean eu faucibus vitae malesuada. Viverra malesuada aliquam et placerat justo porta ipsum parturient. Cursus | ||
nostra varius efficitur lobortis aliquam lectus bibendum. | ||
</LuxFormFieldDescription> | ||
</VisualRegressionWrapper> | ||
</> | ||
)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import tokens from '@lux-design-system/design-tokens/dist/index.json'; | |
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { type LabelHTMLAttributes, type PropsWithChildren } from 'react'; | ||
import { BADGES } from '../../../config/preview'; | ||
import { createDesignTokensStory, createVisualRegressionStory, VisualRegressionWrapper } from '../../utils'; | ||
|
||
const LuxFormFieldLabel = ( | ||
props: PropsWithChildren<LuxFormFieldLabelProps> & LabelHTMLAttributes<HTMLLabelElement>, | ||
|
@@ -18,7 +19,7 @@ const meta = { | |
parameters: { | ||
badges: [BADGES.WIP, BADGES.CANARY], | ||
tokens, | ||
tokensPrefix: 'react-form-label', | ||
tokensPrefix: 'utrecht-form-label', | ||
}, | ||
argTypes: { | ||
children: { | ||
|
@@ -110,3 +111,26 @@ export const CheckedLabel: Story = { | |
type: 'checkbox', | ||
}, | ||
}; | ||
|
||
export const DesignTokens = createDesignTokensStory(meta); | ||
|
||
export const Visual = createVisualRegressionStory(() => ( | ||
<div className="utrecht-document"> | ||
<h4 className="utrecht-heading-3">Light</h4> | ||
<VisualRegressionWrapper className={`lux-theme--logius-light`}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<LuxFormFieldLabel>Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel type="checkbox">Checkbox Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel type="radio">Radio Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel checked>Checked Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel disabled>Disabled Label</LuxFormFieldLabel> | ||
</VisualRegressionWrapper> | ||
<h4 className="utrecht-heading-3">Dark</h4> | ||
<VisualRegressionWrapper className={`lux-theme--logius-dark`}> | ||
<LuxFormFieldLabel>Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel type="checkbox">Checkbox Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel type="radio">Radio Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel checked>Checked Label</LuxFormFieldLabel> | ||
<LuxFormFieldLabel disabled>Disabled Label</LuxFormFieldLabel> | ||
</VisualRegressionWrapper> | ||
</div> | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Als je hier het type aanpast moet je dat ook doen bij de group. Wellicht meoten daar een Generic van maken zodat het type automatisch doorsijpelt naar de option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En dan
string|number
als default type voor devalue