Skip to content
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
1 change: 0 additions & 1 deletion app/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const modKey = /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'cmd' : 'ctrl'
const JumpToButton = () => (
<Button
variant="ghost"
color="secondary"
size="sm"
// TODO: click should open jump to menu
onClick={() => alert('click not implemented, press cmd+k')}
Expand Down
6 changes: 3 additions & 3 deletions app/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ export function TopBar({ children }: { children: React.ReactNode }) {
{otherPickers}
</div>
<div>
<Button variant="default" color="secondary" size="sm" title="Info">
<Button variant="secondary" size="icon" title="Info">
<Info16Icon className="text-quaternary" />
</Button>
<Button color="secondary" size="sm" className="ml-2" title="Notifications">
<Button variant="secondary" size="icon" className="ml-2" title="Notifications">
<Notifications16Icon className="text-quaternary" />
</Button>
<Menu>
<MenuButton
as={Button}
color="secondary"
size="sm"
variant="secondary"
aria-label="User menu"
className="ml-2"
innerClassName="space-x-2"
Expand Down
2 changes: 1 addition & 1 deletion app/components/form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const Form = {
Submit: (props: ButtonProps) => <Button type="submit" size="sm" {...props} />,

Cancel: (props: ButtonProps) => (
<Button variant="ghost" color="secondary" size="sm" {...props}>
<Button variant="ghost" size="sm" {...props}>
Cancel
</Button>
),
Expand Down
2 changes: 1 addition & 1 deletion app/components/form/SideModalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function SideModalForm<TFieldValues extends FieldValues>({
<span>{submitError.error.message}</span>
</div>
)}
<Button variant="ghost" color="secondary" size="sm" onClick={onDismiss}>
<Button variant="ghost" size="sm" onClick={onDismiss}>
Cancel
</Button>
<Button type="submit" size="sm" disabled={submitDisabled || !canSubmit} form={id}>
Expand Down
9 changes: 2 additions & 7 deletions app/components/form/fields/DisksTableField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,10 @@ export function DisksTableField({ control }: { control: Control<InstanceCreateIn
)}

<div className="space-x-3">
<Button variant="default" size="sm" onClick={() => setShowDiskCreate(true)}>
<Button size="sm" onClick={() => setShowDiskCreate(true)}>
Create new disk
</Button>
<Button
variant="ghost"
color="secondary"
size="sm"
onClick={() => setShowDiskAttach(true)}
>
<Button variant="ghost" size="sm" onClick={() => setShowDiskAttach(true)}>
Attach existing disk
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/components/form/fields/NetworkInterfaceField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function NetworkInterfaceField({
/>
)}
<div className="space-x-3">
<Button variant="default" size="sm" onClick={() => setShowForm(true)}>
<Button size="sm" onClick={() => setShowForm(true)}>
Add network interface
</Button>
</div>
Expand Down
23 changes: 17 additions & 6 deletions app/forms/firewall-rules-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,14 @@ export const CommonFields = ({ error, control }: CommonFieldsProps) => {
<div className="flex justify-end">
<Button
variant="ghost"
color="secondary"
size="sm"
className="mr-2.5"
onClick={() => targetForm.reset()}
>
Clear
</Button>
<Button
size="sm"
onClick={targetForm.handleSubmit(({ type, value }) => {
// TODO: show error instead of ignoring click
// TODO: do this with a normal validation
Expand Down Expand Up @@ -267,13 +268,14 @@ export const CommonFields = ({ error, control }: CommonFieldsProps) => {
<div className="flex justify-end">
<Button
variant="ghost"
color="secondary"
size="sm"
className="mr-2.5"
onClick={() => hostForm.reset()}
>
Clear
</Button>
<Button
size="sm"
onClick={hostForm.handleSubmit(({ type, value }) => {
// TODO: show error instead of ignoring click
if (
Expand Down Expand Up @@ -329,10 +331,16 @@ export const CommonFields = ({ error, control }: CommonFieldsProps) => {
control={portRangeForm.control}
/>
<div className="flex justify-end">
<Button variant="ghost" color="secondary" className="mr-2.5">
<Button
variant="ghost"
size="sm"
className="mr-2.5"
onClick={() => portRangeForm.reset()}
>
Clear
</Button>
<Button
size="sm"
onClick={portRangeForm.handleSubmit(({ portRange }) => {
const portRangeValue = portRange.trim()
// TODO: show error instead of ignoring the click
Expand Down Expand Up @@ -390,9 +398,12 @@ export const CommonFields = ({ error, control }: CommonFieldsProps) => {
</div>
</fieldset>

<Divider />

<div className="text-destructive">{error?.error.message}</div>
{error?.error.message && (
<>
<Divider />
<div className="text-destructive">{error.error.message}</div>
</>
)}
</>
)
}
Expand Down
5 changes: 2 additions & 3 deletions app/pages/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default function LoginPage() {
</Button>
<Button
type="submit"
variant="default"
className="w-full"
disabled={loginPost.isLoading}
onClick={() => loginPost.mutate({ body: { username: 'unprivileged' } })}
Expand All @@ -71,7 +70,7 @@ export default function LoginPage() {
</Button>
<Button
type="submit"
variant="ghost"
variant="danger"
className="w-full"
disabled={loginPost.isLoading}
onClick={() => loginPost.mutate({ body: { username: 'other' } })}
Expand All @@ -80,7 +79,7 @@ export default function LoginPage() {
</Button>
<Button
type="submit"
variant="link"
variant="ghost"
className="w-full"
disabled={loginPost.isLoading}
onClick={() => logout.mutate({})}
Expand Down
2 changes: 1 addition & 1 deletion app/pages/OrgAccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function OrgAccessPage() {
</PageHeader>

<TableActions>
<Button size="sm" variant="default" onClick={() => setAddModalOpen(true)}>
<Button size="sm" onClick={() => setAddModalOpen(true)}>
Add user to organization
</Button>
</TableActions>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/OrgsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function OrgsPage() {
<PageTitle icon={<Folder24Icon />}>Organizations</PageTitle>
</PageHeader>
<TableActions>
<Link to={pb.orgNew()} className={buttonStyle({ variant: 'default', size: 'sm' })}>
<Link to={pb.orgNew()} className={buttonStyle({ size: 'sm' })}>
New Organization
</Link>
</TableActions>
Expand Down
5 changes: 1 addition & 4 deletions app/pages/ProjectsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ export default function ProjectsPage() {
<PageTitle icon={<Folder24Icon />}>Projects</PageTitle>
</PageHeader>
<TableActions>
<Link
to={pb.projectNew({ orgName })}
className={buttonStyle({ variant: 'default', size: 'sm' })}
>
<Link to={pb.projectNew({ orgName })} className={buttonStyle({ size: 'sm' })}>
New Project
</Link>
</TableActions>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/SiloAccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function SiloAccessPage() {
</PageHeader>

<TableActions>
<Button size="sm" variant="default" onClick={() => setAddModalOpen(true)}>
<Button size="sm" onClick={() => setAddModalOpen(true)}>
Add user or group
</Button>
</TableActions>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/project/access/ProjectAccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export function ProjectAccessPage() {
</PageHeader>

<TableActions>
<Button size="sm" variant="default" onClick={() => setAddModalOpen(true)}>
<Button size="sm" onClick={() => setAddModalOpen(true)}>
Add user to project
</Button>
</TableActions>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/project/disks/DisksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function DisksPage() {
<TableActions>
<Link
to={pb.diskNew({ orgName, projectName })}
className={buttonStyle({ size: 'sm', variant: 'default' })}
className={buttonStyle({ size: 'sm' })}
>
New Disk
</Link>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/project/instances/InstancesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function InstancesPage() {
</Button>
<Link
to={pb.instanceNew({ orgName, projectName })}
className={buttonStyle({ size: 'sm', variant: 'default' })}
className={buttonStyle({ size: 'sm' })}
>
New Instance
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ export function NetworkingTab() {
<div className="flex gap-3">
<Button
size="sm"
variant="default"
onClick={() => setCreateModalOpen(true)}
disabled={!instanceStopped}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function SerialConsoleTab() {
</div>
<PageActions>
<div className="gutter flex h-20 items-center">
<Button variant="default" size="sm" onClick={() => refetch()}>
<Button size="sm" onClick={() => refetch()}>
Refresh
</Button>
</div>
Expand Down
4 changes: 1 addition & 3 deletions app/pages/project/instances/instance/tabs/StorageTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export function StorageTab() {
<div className="mt-4 flex flex-col gap-3">
<div className="flex gap-3">
<Button
variant="default"
size="sm"
onClick={() => setShowDiskCreate(true)}
disabledReason="Instance must be stopped to create a disk"
Expand All @@ -142,8 +141,7 @@ export function StorageTab() {
Create new disk
</Button>
<Button
variant="ghost"
color="secondary"
variant="secondary"
size="sm"
onClick={() => setShowDiskAttach(true)}
disabledReason="Instance must be stopped to attach a disk"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const VpcFirewallRulesTab = () => {
return (
<>
<div className="mb-3 flex justify-end space-x-4">
<Button size="sm" variant="default" onClick={() => setCreateModalOpen(true)}>
<Button size="sm" onClick={() => setCreateModalOpen(true)}>
New rule
</Button>
{createModalOpen && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const VpcRoutersTab = () => {
return (
<>
<div className="mb-3 flex justify-end space-x-4">
<Button size="sm" variant="default" onClick={() => setCreating(true)}>
<Button size="sm" onClick={() => setCreating(true)}>
New router
</Button>
{creating && <CreateVpcRouterForm onDismiss={() => setCreating(false)} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const VpcSubnetsTab = () => {
return (
<>
<div className="mb-3 flex justify-end space-x-4">
<Button size="sm" variant="default" onClick={() => setCreating(true)}>
<Button size="sm" onClick={() => setCreating(true)}>
New subnet
</Button>
{creating && <CreateSubnetForm onDismiss={() => setCreating(false)} />}
Expand Down
2 changes: 1 addition & 1 deletion app/pages/project/networking/VpcsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function VpcsPage() {
<TableActions>
<Link
to={pb.vpcNew({ orgName, projectName })}
className={buttonStyle({ size: 'sm', variant: 'default' })}
className={buttonStyle({ size: 'sm' })}
>
New Vpc
</Link>
Expand Down
5 changes: 1 addition & 4 deletions app/pages/project/snapshots/SnapshotsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ export function SnapshotsPage() {
<PageTitle icon={<Snapshots24Icon />}>Snapshots</PageTitle>
</PageHeader>
<TableActions>
<Link
to={pb.snapshotNew(projectParams)}
className={buttonStyle({ size: 'sm', variant: 'default' })}
>
<Link to={pb.snapshotNew(projectParams)} className={buttonStyle({ size: 'sm' })}>
New Snapshot
</Link>
</TableActions>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/system/SilosPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function SilosPage() {
<PageTitle icon={<Cloud24Icon />}>Silos</PageTitle>
</PageHeader>
<TableActions>
<Link to={pb.siloNew()} className={buttonStyle({ variant: 'default', size: 'sm' })}>
<Link to={pb.siloNew()} className={buttonStyle({ size: 'sm' })}>
New silo
</Link>
</TableActions>
Expand Down
1 change: 0 additions & 1 deletion libs/ui/lib/bulk-action-menu/BulkActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export function BulkActionMenu({ children, selectedCount }: BulkActionMenuProps)
BulkActionMenu.Button = (props: Omit<ButtonProps, 'size' | 'variant'>) => (
<Button
size="sm"
variant="default"
// TODO: Remove this border once the proper button styles are available
className="rounded border !border-accent-secondary"
{...props}
Expand Down
39 changes: 13 additions & 26 deletions libs/ui/lib/button/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Section } from '../../util/story-section'
import { Button, colors, variants } from './Button'
import { Button, variants } from './Button'

// TODO: sizes (I guess)

Expand All @@ -12,31 +12,18 @@ export const All = () => {
<div className="flex flex-row flex-wrap">
{states.map((state) => (
<Section key={state} title={state}>
{colors.map((color) => (
<div key={color} className="mb-2 flex flex-row space-x-2">
{variants.map((variant) => (
<>
<Button
key={variant}
variant={variant}
color={color}
className={`:${state}`}
>
{variant}
</Button>
<Button
key={variant}
variant={variant}
color={color}
className={`:${state}`}
loading
>
{variant}
</Button>
</>
))}
</div>
))}
<div className="mb-2 flex flex-row space-x-2">
{variants.map((variant) => (
<>
<Button key={variant} variant={variant} className={`:${state}`}>
{variant}
</Button>
<Button key={variant} variant={variant} className={`:${state}`} loading>
{variant}
</Button>
</>
))}
</div>
</Section>
))}
</div>
Expand Down
Loading