diff --git a/src/utilities/background/background.mdx b/src/utilities/background/background.mdx new file mode 100644 index 000000000..ddb60b52f --- /dev/null +++ b/src/utilities/background/background.mdx @@ -0,0 +1,20 @@ +import { Canvas, Meta } from '@storybook/addon-docs/blocks'; + +import * as BackgroundStories from './background.stories.js'; + + + +# Background + +These utilities apply background colors. For accessibility purposes, these utilities should be paired with u-text-light. + + + + + + + + + + + diff --git a/src/utilities/background/background.scss b/src/utilities/background/background.scss new file mode 100644 index 000000000..966a35202 --- /dev/null +++ b/src/utilities/background/background.scss @@ -0,0 +1,21 @@ +@use '../../compiled/tokens/scss/color'; + +.u-bg-green { + background: color.$base-green !important; +} + +.u-bg-purple { + background: color.$base-purple !important; +} + +.u-bg-fuchsia { + background: color.$base-fuchsia !important; +} + +.u-bg-orange { + background: color.$base-orange !important; +} + +.u-bg-none { + background: transparent !important; +} diff --git a/src/utilities/background/background.stories.js b/src/utilities/background/background.stories.js new file mode 100644 index 000000000..7f9673149 --- /dev/null +++ b/src/utilities/background/background.stories.js @@ -0,0 +1,58 @@ +/** @import { Args, Meta, StoryObj } from '@storybook/html' */ +import './background.scss'; + +/** @param {Args} args */ +const backgroundStory = (args) => { + const classNames = [args.color || '']; + const textColor = [args.text || '']; + const className = classNames + .map((segment) => (segment.length > 0 ? `u-bg-${segment}` : 'u-bg')) + .join(' '); + return `
This is text that has the u-text-light utility class applied.
+This is text that has the u-text-dark utility class applied, overriding the u-text-light class applied to the parent element.
+