Skip to content

Commit

Permalink
refactor: implementing suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aminaopio committed Dec 5, 2024
1 parent 965f1e4 commit 8bfd0da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions apps/docs/docs/learn/06-recipes/02-variants.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Here’s how you can create a button component with different visual styles base
import * as stylex from '@stylexjs/stylex';

const styles = stylex.create({
base: {
appearance: 'none',
borderWidth: 0,
},
});
const variants = stylex.create({
primary: {
backgroundColor: {
default: 'blue',
Expand All @@ -36,9 +42,8 @@ const styles = stylex.create({
color: 'white',
},
});

function Button({ variant = 'primary', ...props }) {
return <button {...props} {...stylex.props(styles[variant], props.style)} />;
return <button {...props} {...stylex.props(styles.base, variants[variant], props.style)} />;
}

// Usage
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/learn/06-recipes/03-descendant styles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const styles = stylex.create({
},
},
child: {
color: `var(${vars.childColor})`,
color: `vars.childColor`,
},
});

Expand Down

0 comments on commit 8bfd0da

Please sign in to comment.