-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storybook: Add stories for the ContrastChecker component (#68120)
* Storybook: Add stories for the contrast-checker component * Storybook: Add default color values for initial component visibility Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
- Loading branch information
1 parent
a34eaca
commit af49fcb
Showing
1 changed file
with
117 additions
and
0 deletions.
There are no files selected for viewing
117 changes: 117 additions & 0 deletions
117
packages/block-editor/src/components/contrast-checker/stories/index.story.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import ContrastChecker from '../'; | ||
|
||
const meta = { | ||
title: 'BlockEditor/ContrastChecker', | ||
component: ContrastChecker, | ||
parameters: { | ||
docs: { | ||
canvas: { sourceState: 'shown' }, | ||
description: { | ||
component: | ||
'Determines if contrast for text styles is sufficient (WCAG 2.0 AA) when used with a given background color.', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
backgroundColor: { | ||
control: 'color', | ||
description: | ||
'The background color to check the contrast of text against.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
fallbackBackgroundColor: { | ||
control: 'color', | ||
description: | ||
'A fallback background color value, in case `backgroundColor` is not available.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
textColor: { | ||
control: 'color', | ||
description: | ||
'The text color to check the contrast of the background against.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
fallbackTextColor: { | ||
control: 'color', | ||
description: | ||
'A fallback text color value, in case `textColor` is not available.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
fontSize: { | ||
control: 'number', | ||
description: | ||
'The font-size (as a `px` value) of the text to check the contrast against.', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
}, | ||
isLargeText: { | ||
control: 'boolean', | ||
description: | ||
'Whether the text is large (approximately `24px` or higher).', | ||
table: { | ||
type: { | ||
summary: 'boolean', | ||
}, | ||
}, | ||
}, | ||
linkColor: { | ||
control: 'color', | ||
description: 'The link color to check the contrast against.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
fallbackLinkColor: { | ||
control: 'color', | ||
description: 'Fallback link color if linkColor is not available.', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
enableAlphaChecker: { | ||
control: 'boolean', | ||
description: 'Whether to enable checking for transparent colors.', | ||
table: { | ||
type: { | ||
summary: 'boolean', | ||
}, | ||
defaultValue: { summary: false }, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default = { | ||
args: { | ||
backgroundColor: '#ffffff', | ||
textColor: '#ffffff', | ||
}, | ||
}; |
af49fcb
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.
Flaky tests detected in af49fcb.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12515761337
📝 Reported issues:
/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js