mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-28 12:23:24 +01:00
merge buttons and triggers together
This commit is contained in:
3 files changed
+26
-27
No files matched your search
@@ -128,6 +128,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: var(--outline-focus);
|
||||
box-shadow: var(--shadow-focus);
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
cursor: default;
|
||||
opacity: 0.5;
|
||||
|
||||
@@ -8,34 +8,7 @@
|
||||
}
|
||||
|
||||
.Trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-3);
|
||||
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border: none;
|
||||
border-radius: var(--radius-max);
|
||||
|
||||
background-color: var(--gray-1);
|
||||
outline: var(--outline-interactive);
|
||||
outline-offset: calc(-1 * var(--space-1));
|
||||
color: var(--gray-12);
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
&:focus-visible {
|
||||
outline: var(--outline-focus);
|
||||
box-shadow: var(--shadow-focus);
|
||||
}
|
||||
|
||||
svg,
|
||||
img {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
/*
|
||||
* Another unselectable Radix component, being selected by span instead.
|
||||
|
||||
@@ -1,12 +1,33 @@
|
||||
import { Select as _ } from "radix-ui";
|
||||
import type { ComponentProps } from "react";
|
||||
import { classNames } from "../../ui/classNames";
|
||||
import { composeRadixComponents } from "../../ui/compose";
|
||||
import { Button } from "../Button";
|
||||
import { Discriminator } from "../DropdownMenu";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
type SelectTriggerProps = ComponentProps<typeof _.Trigger>;
|
||||
|
||||
function Trigger({ className, children, ...props }: SelectTriggerProps) {
|
||||
return (
|
||||
<_.Trigger asChild {...props}>
|
||||
<Button
|
||||
variant="outline"
|
||||
color="gray"
|
||||
className={classNames(styles.Trigger, className)}
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
</_.Trigger>
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: for select, context menu, and dropdown menus, use scroller curtains
|
||||
export const Select = {
|
||||
...composeRadixComponents(_, styles, {
|
||||
Content: { position: "popper", align: "center" },
|
||||
}),
|
||||
|
||||
Discriminator,
|
||||
Trigger,
|
||||
};
|
||||
Reference in new issue
Block a user