Skip to content

Commit

Permalink
style(Theme): set background, color by default with theme zones (#11895)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
tw15egan and kodiakhq[bot] authored Aug 3, 2022
1 parent c5c1574 commit f78146c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/react/src/components/Button/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { action } from '@storybook/addon-actions';
import { Add } from '@carbon/icons-react';
import { default as Button, ButtonSkeleton } from '../Button';
import ButtonSet from '../ButtonSet';
import { Theme } from '../Theme';
import mdx from './Button.mdx';

export default {
Expand Down Expand Up @@ -78,6 +79,25 @@ export const Tertiary = (args) => {
);
};

export const ThemeTest = () => {
return (
<Theme theme="g100">
<Button kind="primary" disabled>
Hello world
</Button>
<Button kind="secondary" disabled>
Hello world
</Button>
<Button kind="tertiary" disabled>
Hello world
</Button>
<Button kind="ghost" disabled>
Hello world
</Button>
</Theme>
);
};

export const Danger = (args) => {
return (
<>
Expand Down
3 changes: 3 additions & 0 deletions packages/styles/scss/_zone.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ $-components: (

@each $name, $theme in $zones {
.#{config.$prefix}--#{'' + $name} {
background: var(--cds-background);
color: var(--cds-text-primary);

@each $key, $value in $theme {
@if type-of($value) == color {
@include custom-property.declaration($key, $value);
Expand Down

0 comments on commit f78146c

Please sign in to comment.