Skip to content

Commit

Permalink
refactor(components): ♻️ update button, checkbox, radio & avatar grou…
Browse files Browse the repository at this point in the history
…ps (#243)
  • Loading branch information
navin-moorthy authored Dec 29, 2021
1 parent 9702410 commit 56e4ee6
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`<AvatarGroup /> should be able to overwrite specific avatar size 1`] =
<DocumentFragment>
<div
aria-label="avatar group"
class="inline-flex items-center -space-x-1"
class="inline-flex items-center -space-x-0.5"
role="group"
>
<span
Expand Down Expand Up @@ -73,7 +73,7 @@ exports[`<AvatarGroup /> should pass the size to all avatars 1`] = `
<DocumentFragment>
<div
aria-label="avatar group"
class="inline-flex items-center -space-x-1"
class="inline-flex items-center -space-x-0.5"
role="group"
>
<span
Expand Down Expand Up @@ -142,7 +142,7 @@ exports[`<AvatarGroup /> should render correctly 1`] = `
<DocumentFragment>
<div
aria-label="avatar group"
class="inline-flex items-center -space-x-1.5"
class="inline-flex items-center -space-x-1"
role="group"
>
<span
Expand Down
1 change: 1 addition & 0 deletions src/checkbox-group/CheckboxShowMore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const CheckboxShowMore: React.FC<CheckboxShowMoreProps> = props => {
const theme = useTheme("checkbox");
const buttonClassName = cx(
theme.group.showMore.button.common[stack],
size === "lg" ? theme.group.showMore.button.lg : "",
hasExpandStarted ? "" : theme.group.showMore.button.expanded[stack],
);
const contentClassName = cx(theme.group.showMore.content[stack]);
Expand Down
7 changes: 4 additions & 3 deletions src/radio-group/RadioShowMore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ export const RadioShowMore: React.FC<RadioShowMoreProps> = props => {
const [hasExpandStarted, setHasExpandStarted] = React.useState(false);

const theme = useTheme("radio");
const buttonClassName = cx(theme.group.showMore.button.common[stack]);
const contentClassName = cx(
theme.group.showMore.content[stack],
const buttonClassName = cx(
theme.group.showMore.button.common[stack],
size === "lg" ? theme.group.showMore.button.lg : "",
hasExpandStarted ? "" : theme.group.showMore.button.expanded[stack],
);
const contentClassName = cx(theme.group.showMore.content[stack]);

const finalChildren = React.Children.map(children, child => {
return passProps(child, {
Expand Down
5 changes: 0 additions & 5 deletions src/show-more/stories/ShowMoreVertical.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ export default {
export const Default: Story = {
args: { direction: "vertical" },
};

// export const Horizontal: Story = {
// render: args => <ShowMoreHorizontalComponent {...args} />,
// args: { direction: "horizontal" },
// };
8 changes: 4 additions & 4 deletions src/theme/defaultTheme/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ export const avatar = {
common: "inline-flex items-center",
size: {
xs: "-space-x-px",
sm: "-space-x-px",
md: "-space-x-1",
lg: "-space-x-1",
xl: "-space-x-1.5",
sm: "-space-x-0.5",
md: "-space-x-0.5",
lg: "-space-x-0.5",
xl: "-space-x-1",
"2xl": "-space-x-1.5",
"3xl": "-space-x-2",
},
Expand Down
10 changes: 5 additions & 5 deletions src/theme/defaultTheme/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export const button = {
ghost: "bg-white text-gray-600 border border-transparent",
},
hover: {
solid: "hover:bg-gray-700",
subtle: "hover:bg-gray-200",
outline: "hover:border-gray-300 hover:shadow-sm",
ghost: "hover:bg-gray-100",
solid: "hover:bg-gray-700 hover:z-10",
subtle: "hover:bg-gray-200 hover:z-10",
outline: "hover:border-gray-300 hover:shadow-sm hover:z-10",
ghost: "hover:bg-gray-100 hover:z-10",
},
active: {
solid: "active:bg-gray-800",
Expand All @@ -30,7 +30,7 @@ export const button = {
subtle:
"focus-visible:ring-2 focus-visible:ring-gray-300 focus-visible:z-10",
outline:
"focus-visible:ring-2 focus-visible:ring-gray-200 focus-visible:z-10",
"focus-visible:border-gray-300 focus-visible:!border-r-[1px] focus-visible:ring-2 focus-visible:ring-gray-200 focus-visible:z-10",
ghost:
"focus-visible:ring-2 focus-visible:ring-gray-200 focus-visible:z-10",
},
Expand Down
11 changes: 6 additions & 5 deletions src/theme/defaultTheme/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ export const checkbox = {
common: "flex flex-col items-start",
size: {
sm: "space-y-1",
md: "space-y-2",
lg: "space-y-3",
md: "space-y-1",
lg: "space-y-1",
},
},
horizontal: {
common: "flex flex-row w-fit",
size: {
sm: "space-x-4",
md: "space-x-4",
lg: "space-x-4",
sm: "space-x-1",
md: "space-x-1",
lg: "space-x-1",
},
},
showMore: {
button: {
common: { vertical: "justify-start w-full", horizontal: "min-w-max" },
expanded: { vertical: "!mt-0", horizontal: "!ml-0" },
lg: "min-h-9 rounded-[10px]",
},
content: {
vertical: "flex flex-col space-y-2 w-full",
Expand Down
16 changes: 10 additions & 6 deletions src/theme/defaultTheme/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@ export const radio = {
common: "flex flex-col items-start",
size: {
sm: "space-y-1",
md: "space-y-2",
lg: "space-y-3",
md: "space-y-1",
lg: "space-y-1",
},
},
horizontal: {
common: "flex flex-row w-fit",
size: {
sm: "space-x-4",
md: "space-x-4",
lg: "space-x-4",
sm: "space-x-1",
md: "space-x-1",
lg: "space-x-1",
},
},
showMore: {
button: {
common: { vertical: "justify-start w-full", horizontal: "min-w-max" },
common: {
vertical: "justify-start w-full",
horizontal: "min-w-max",
},
expanded: { vertical: "!mt-0", horizontal: "!ml-0" },
lg: "min-h-9 rounded-[10px]",
},
content: {
vertical: "flex flex-col space-y-2 w-full",
Expand Down
6 changes: 2 additions & 4 deletions tailwindPlugins/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ const utilities = plugin(function ({ addUtilities, theme }) {
".collapse-border > :first-of-type:not(:last-of-type)": {
"border-top-right-radius": "0px",
"border-bottom-right-radius": "0px",
"border-right-width": "0px",
},
".collapse-border > :not(:first-of-type):not(:last-of-type)": {
"border-radius": "0px",
"border-right-width": "0px",
"border-left-width": "0px",
"margin-left": "-1px",
},
".collapse-border > :not(:first-of-type):last-of-type": {
"border-top-left-radius": "0px",
"border-bottom-left-radius": "0px",
"border-left-width": "0px",
"margin-left": "-1px",
},
".meter-radius > :first-of-type:not(:last-of-type)": {
"border-top-right-radius": "0px",
Expand Down

1 comment on commit 56e4ee6

@vercel
Copy link

@vercel vercel bot commented on 56e4ee6 Dec 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.