Skip to content

Commit

Permalink
Update button example styles (#2764)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegohaz committed Aug 25, 2023
1 parent 9938ee1 commit e78ed91
Show file tree
Hide file tree
Showing 34 changed files with 100 additions and 61 deletions.
39 changes: 35 additions & 4 deletions examples/button/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,39 @@
whitespace-nowrap
aria-disabled:opacity-50
sm:gap-2
bg-blue-600
text-white
hover:bg-blue-800
bg-white
dark:bg-white/5
text-black
dark:text-white
hover:bg-gray-100
dark:hover:bg-white/10
aria-expanded:bg-gray-100
aria-expanded:dark:bg-white/10
data-[focus-visible]:outline
active:[transform:scale(0.98)]
aria-expanded:active:[transform:scale(1)]
[box-shadow:inset_0_0_0_1px_rgba(0,0,0,0.1),inset_0_-1px_0_rgba(0,0,0,0.1),0_1px_1px_rgba(0,0,0,0.1)]
dark:[box-shadow:inset_0_0_0_1px_rgba(255,255,255,0.1),inset_0_-1px_0_1px_rgba(0,0,0,0.2),inset_0_1px_0_rgba(255,255,255,0.05)]
outline-2
outline-offset-2
outline-blue-600
data-[focus-visible]:outline
;
}

.flat {
@apply
[box-shadow:none]
dark:[box-shadow:none]
;
}

.primary {
@apply
text-white
bg-blue-600
dark:bg-blue-800
hover:bg-blue-800
dark:hover:bg-blue-600
;
}

Expand All @@ -32,12 +58,17 @@
dark:bg-transparent
hover:bg-black/5
dark:hover:bg-white/5
[box-shadow:none]
dark:[box-shadow:none]
;
}

.danger {
@apply
text-white
bg-red-600
dark:bg-red-700
hover:bg-red-700
dark:hover:bg-red-600
;
}
2 changes: 1 addition & 1 deletion examples/dialog-nested/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function Example() {
</tbody>
</table>

<Ariakit.DialogDismiss className="button">
<Ariakit.DialogDismiss className="button primary">
Checkout
</Ariakit.DialogDismiss>

Expand Down
4 changes: 2 additions & 2 deletions examples/dialog-react-router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Tweet() {
render={<textarea placeholder="What's happening?" rows={5} />}
/>
</label>
<Ariakit.Button type="submit" className="button">
<Ariakit.Button type="submit" className="button primary">
Tweet
</Ariakit.Button>
</form>
Expand All @@ -50,7 +50,7 @@ function Tweet() {
function Home() {
return (
<>
<Link to="/tweet" className="button">
<Link to="/tweet" className="button primary">
Tweet
</Link>
<Outlet />
Expand Down
6 changes: 6 additions & 0 deletions examples/dialog/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@import url("../button/style.css");

.button {
@apply
font-medium
;
}

.backdrop {
@apply
[backdrop-filter:blur(4px)]
Expand Down
4 changes: 3 additions & 1 deletion examples/form-select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export default function Example() {
<Ariakit.FormError name={form.names.fruit} className="error" />
</div>
<div className="buttons">
<Ariakit.FormSubmit className="button">Submit</Ariakit.FormSubmit>
<Ariakit.FormSubmit className="button primary">
Submit
</Ariakit.FormSubmit>
</div>
</Ariakit.Form>
);
Expand Down
2 changes: 1 addition & 1 deletion examples/form-select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(
<Ariakit.Select
store={select}
ref={ref}
className="select"
className="button"
{...props}
onBlur={(event) => {
props.onBlur?.(event);
Expand Down
5 changes: 3 additions & 2 deletions examples/form-select/style.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@import url("../select/style.css");
@import url("../form/style.css");

.select {
.primary {
@apply
w-full
justify-center
;
}

2 changes: 1 addition & 1 deletion examples/hovercard-disclosure/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function Example() {
Ariakit
</Ariakit.HovercardHeading>
<p>Toolkit for building accessible web apps with React.</p>
<a href="https://twitter.com/ariakitjs" className="button">
<a href="https://twitter.com/ariakitjs" className="button primary flat">
Follow
</a>
</Ariakit.Hovercard>
Expand Down
2 changes: 1 addition & 1 deletion examples/hovercard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Example() {
Ariakit
</Ariakit.HovercardHeading>
<p>Toolkit for building accessible web apps with React.</p>
<a href="https://twitter.com/ariakitjs" className="button">
<a href="https://twitter.com/ariakitjs" className="button primary flat">
Follow
</a>
</Ariakit.Hovercard>
Expand Down
6 changes: 6 additions & 0 deletions examples/menu/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
@import url("../button/style.css");
@import url("../separator/style.css");

.button {
@apply
font-medium
;
}

.menu {
@apply
max-h-[var(--popover-available-height)]
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions examples/popover/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@import url("../button/style.css");

.button {
@apply
font-medium
;
}

.popover {
@apply
z-50
Expand Down
2 changes: 1 addition & 1 deletion examples/select-animated/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function Example() {
return (
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Favorite fruit</Ariakit.SelectLabel>
<Ariakit.Select store={select} className="select" />
<Ariakit.Select store={select} className="button" />
{mounted && (
<Ariakit.SelectPopover
store={select}
Expand Down
2 changes: 1 addition & 1 deletion examples/select-autofill/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Example() {
<label htmlFor="email">Email</label>
<input type="email" id="email" name="email" className="input" />
<Ariakit.SelectLabel store={select}>Role</Ariakit.SelectLabel>
<Ariakit.Select store={select} name="role" className="select" />
<Ariakit.Select store={select} name="role" className="button" />
<Ariakit.SelectPopover store={select} sameWidth className="popover">
<Ariakit.SelectItem className="select-item" value="Student" />
<Ariakit.SelectItem className="select-item" value="Tutor" />
Expand Down
2 changes: 1 addition & 1 deletion examples/select-autofill/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
;
}

.select {
.button {
@apply
[&[data-autofill]]:bg-[rgb(219_237_255)]
[&[data-autofill]]:dark:bg-[rgb(36_107_179)]
Expand Down
2 changes: 1 addition & 1 deletion examples/select-combobox-focus-within/select-combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const SelectCombobox = React.forwardRef<
<Ariakit.Select
ref={ref}
store={select}
className="select"
className="button"
{...props}
/>
{mounted && (
Expand Down
2 changes: 1 addition & 1 deletion examples/select-combobox-virtualized/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Example() {
<>
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Country</Ariakit.SelectLabel>
<Ariakit.Select store={select} className="select">
<Ariakit.Select store={select} className="button">
<span className="select-value">
{selectValue || "Select a country"}
</span>
Expand Down
2 changes: 1 addition & 1 deletion examples/select-combobox-virtualized/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import url("../select-combobox/style.css");

.select {
.button {
@apply
w-[260px]
;
Expand Down
2 changes: 1 addition & 1 deletion examples/select-combobox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Example() {
return (
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Favorite fruit</Ariakit.SelectLabel>
<Ariakit.Select store={select} className="select" />
<Ariakit.Select store={select} className="button" />
<Ariakit.SelectPopover
store={select}
gutter={4}
Expand Down
2 changes: 1 addition & 1 deletion examples/select-grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function Example() {
return (
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Position</Ariakit.SelectLabel>
<Ariakit.Select store={select} showOnKeyDown={false} className="select">
<Ariakit.Select store={select} showOnKeyDown={false} className="button">
<Square value={value} />
{value}
<Ariakit.SelectArrow />
Expand Down
2 changes: 1 addition & 1 deletion examples/select-group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function Example() {
return (
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Favorite food</Ariakit.SelectLabel>
<Ariakit.Select store={select} className="select" />
<Ariakit.Select store={select} className="button" />
<Ariakit.SelectPopover
store={select}
gutter={4}
Expand Down
2 changes: 1 addition & 1 deletion examples/select-item-custom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Example() {
return (
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Account</Ariakit.SelectLabel>
<Ariakit.Select store={select} className="select">
<Ariakit.Select store={select} className="button">
{renderValue(value)}
<Ariakit.SelectArrow />
</Ariakit.Select>
Expand Down
2 changes: 1 addition & 1 deletion examples/select-item-custom/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
;
}

.select {
.button {
@apply
w-80
justify-start
Expand Down
4 changes: 2 additions & 2 deletions examples/select-menu-default-open/filter-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const FilterSelect = React.forwardRef<
<div className="filter">
<Ariakit.Select
ref={ref}
className="select"
className="button select"
{...props}
store={select}
aria-labelledby={labelId}
Expand All @@ -72,7 +72,7 @@ export const FilterSelect = React.forwardRef<
</Ariakit.SelectPopover>
{onRemove && (
<Ariakit.Button
className="select"
className="button select"
aria-label={`Remove ${label} filter`}
onClick={() => onRemove()}
>
Expand Down
2 changes: 2 additions & 0 deletions examples/select-menu-default-open/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

.button {
@apply
w-auto
justify-center
rounded-md
aria-expanded:bg-black/10
aria-expanded:dark:bg-white/10
Expand Down
2 changes: 1 addition & 1 deletion examples/select-multiple/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function Example() {
return (
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Favorite food</Ariakit.SelectLabel>
<Ariakit.Select store={select} className="select">
<Ariakit.Select store={select} className="button">
{renderValue(value)}
<Ariakit.SelectArrow />
</Ariakit.Select>
Expand Down
2 changes: 1 addition & 1 deletion examples/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function Example() {
return (
<div className="wrapper">
<Ariakit.SelectLabel store={select}>Favorite fruit</Ariakit.SelectLabel>
<Ariakit.Select store={select} className="select" />
<Ariakit.Select store={select} className="button" />
<Ariakit.SelectPopover
store={select}
gutter={4}
Expand Down
23 changes: 3 additions & 20 deletions examples/select/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import url("../button/style.css");

.wrapper {
@apply
flex
Expand All @@ -12,29 +14,10 @@
;
}

.select {
.button {
@apply
flex
w-[200px]
h-10
cursor-default
items-center
justify-between
gap-1
rounded-md
px-4
text-base
whitespace-nowrap
bg-black/[7.5%]
hover:bg-black/[11.25%]
aria-expanded:bg-black/[11.25%]
dark:bg-white/[7.5%]
dark:hover:bg-white/[11.25%]
dark:aria-expanded:bg-white/[11.25%]
shadow-button
dark:shadow-button-dark
focus-visible:ariakit-outline-input
aria-disabled:opacity-50
;
}

Expand Down
6 changes: 6 additions & 0 deletions examples/toolbar-select/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
.select-item {
@apply pr-8;
}

.button {
@apply
w-auto
;
}
4 changes: 3 additions & 1 deletion examples/toolbar-select/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const ToolbarButton = React.forwardRef<
HTMLButtonElement,
Ariakit.ToolbarItemProps
>(function ToolbarButton(props, ref) {
return <Ariakit.ToolbarItem ref={ref} className="button" {...props} />;
return (
<Ariakit.ToolbarItem ref={ref} className="button secondary" {...props} />
);
});

export const ToolbarSeparator = React.forwardRef<
Expand Down

1 comment on commit e78ed91

@vercel
Copy link

@vercel vercel bot commented on e78ed91 Aug 25, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ariakit – ./

ariakit-ariakit.vercel.app
ariakit-git-main-ariakit.vercel.app
ariakit.org
www.ariakit.org

Please sign in to comment.