Skip to content
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

feat: fill variant in icon button, chip and menu item components #35

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/chip/Chip.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const Chip = recipe({
display: "inline-flex",
alignItems: "center",
color: OnContainer,
backgroundColor: Container,
cursor: "pointer",

selectors: {
Expand Down Expand Up @@ -86,6 +85,14 @@ export const Chip = recipe({
gap: config.space.S200,
},
},
fill: {
Soft: {
backgroundColor: Container,
},
None: {
backgroundColor: "transparent",
},
},
outlined: {
true: {
border: `${config.borderWidth.B400} solid ${ContainerLine}`,
Expand All @@ -95,6 +102,7 @@ export const Chip = recipe({
},
defaultVariants: {
variant: "Surface",
fill: "Soft",
size: "400",
radii: "400",
},
Expand Down
4 changes: 4 additions & 0 deletions src/components/chip/Chip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export default {
"Critical",
],
},
fill: {
control: "select",
options: ["Soft", "None"],
},
size: {
control: "select",
options: ["400", "500"],
Expand Down
2 changes: 2 additions & 0 deletions src/components/chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const Chip = as<"button", ChipProps & css.ChipVariants>(
as: AsChip = "button",
className,
variant,
fill,
size,
outlined,
radii,
Expand All @@ -29,6 +30,7 @@ export const Chip = as<"button", ChipProps & css.ChipVariants>(
className={classNames(
css.Chip({
variant,
fill,
size,
outlined,
radii,
Expand Down
10 changes: 9 additions & 1 deletion src/components/icon-button/IconButton.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const IconButton = recipe({
cursor: "pointer",
textDecoration: "none",

backgroundColor: Container,
color: OnContainer,

selectors: {
Expand Down Expand Up @@ -79,6 +78,14 @@ export const IconButton = recipe({
Warning: getVariant("Warning"),
Critical: getVariant("Critical"),
},
fill: {
Soft: {
backgroundColor: Container,
},
None: {
backgroundColor: "transparent",
},
},
outlined: {
true: {
boxShadow: `inset 0 0 0 ${config.borderWidth.B400} ${ContainerLine}`,
Expand All @@ -89,6 +96,7 @@ export const IconButton = recipe({
defaultVariants: {
size: "400",
variant: "Surface",
fill: "Soft",
radii: "400",
},
});
Expand Down
7 changes: 5 additions & 2 deletions src/components/icon-button/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { as } from "../as";
import * as css from "./IconButton.css";

export const IconButton = as<"button", css.IconButtonVariants>(
({ as: AsIconButton = "button", className, size, variant, radii, outlined, ...props }, ref) => (
(
{ as: AsIconButton = "button", className, size, variant, fill, radii, outlined, ...props },
ref
) => (
<AsIconButton
className={classNames(css.IconButton({ variant, size, radii, outlined }), className)}
className={classNames(css.IconButton({ variant, fill, size, radii, outlined }), className)}
{...props}
ref={ref}
/>
Expand Down
10 changes: 9 additions & 1 deletion src/components/menu/MenuItem.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const MenuItem = recipe({
alignItems: "center",
justifyContent: "start",
cursor: "pointer",
backgroundColor: Container,
color: OnContainer,

selectors: {
Expand Down Expand Up @@ -69,6 +68,14 @@ export const MenuItem = recipe({
Warning: getVariant("Warning"),
Critical: getVariant("Critical"),
},
fill: {
Soft: {
backgroundColor: Container,
},
None: {
backgroundColor: "transparent",
},
},
size: {
"300": {
vars: {
Expand All @@ -91,6 +98,7 @@ export const MenuItem = recipe({
},
defaultVariants: {
variant: "Surface",
fill: "Soft",
size: "400",
radii: "0",
},
Expand Down
4 changes: 4 additions & 0 deletions src/components/menu/MenuItem.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export default {
"Critical",
],
},
fill: {
control: "select",
options: ["Soft", "None"],
},
radii: {
control: "select",
options: ["inherit", 0, 300, 400, 500, "Pill"],
Expand Down
3 changes: 2 additions & 1 deletion src/components/menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const MenuItem = as<"button", MenuItemProps & css.MenuItemVariants>(
as: AsMenuItem = "button",
className,
variant,
fill,
size,
radii,
before,
Expand All @@ -24,7 +25,7 @@ export const MenuItem = as<"button", MenuItemProps & css.MenuItemVariants>(
ref
) => (
<AsMenuItem
className={classNames(css.MenuItem({ variant, size, radii }), className)}
className={classNames(css.MenuItem({ variant, fill, size, radii }), className)}
data-ui-before={before ? true : undefined}
data-ui-after={after ? true : undefined}
{...props}
Expand Down
Loading