-
Notifications
You must be signed in to change notification settings - Fork 15
Refetch button on instances page #1295
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ import { assertUnreachable } from '@oxide/util' | |
|
|
||
| import './button.css' | ||
|
|
||
| export const buttonSizes = ['sm', 'base'] as const | ||
| export const buttonSizes = ['sm', 'icon', 'base'] as const | ||
| export const variants = ['default', 'ghost', 'link'] as const | ||
| export const colors = ['primary', 'secondary', 'destructive', 'notice'] as const | ||
|
|
||
|
|
@@ -17,6 +17,8 @@ export type Color = typeof colors[number] | |
|
|
||
| const sizeStyle: Record<ButtonSize, string> = { | ||
| sm: 'h-8 px-3 text-mono-sm svg:w-4', | ||
| // meant for buttons that only contain a single icon | ||
| icon: 'h-8 w-8 text-mono-sm svg:w-4', | ||
| base: 'h-10 px-3 text-mono-md svg:w-5', | ||
| } | ||
|
|
||
|
|
@@ -70,7 +72,17 @@ type ButtonStyleProps = { | |
| color?: Color | ||
| } | ||
|
|
||
| export type ButtonProps = React.ComponentPropsWithRef<'button'> & | ||
| export type ButtonProps = Pick< | ||
| React.ComponentProps<'button'>, | ||
| | 'className' | ||
| | 'onClick' | ||
| | 'aria-disabled' | ||
| | 'disabled' | ||
| | 'children' | ||
| | 'type' | ||
| | 'title' | ||
| | 'form' | ||
| > & | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose it's fine. It's a code change to address tooltip content though which seems to be a bit of a smell, but I agree the tooltip isn't incredibly helpful. We should probably change these to interfaces anyway. Doing so it basically just won't show anything in the tooltip anyway, ha. That doesn't make the tooltip experience any better, but maybe it would assuage the aesthetic concern of the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not just the tooltip content, it's also the real possibility that there could be buttons out there with any of those props. I like being able to rule that out. |
||
| ButtonStyleProps & { | ||
| innerClassName?: string | ||
| loading?: boolean | ||
|
|
@@ -106,6 +118,7 @@ const noop: MouseEventHandler<HTMLButtonElement> = (e) => { | |
| export const Button = forwardRef<HTMLButtonElement, ButtonProps>( | ||
| ( | ||
| { | ||
| type = 'button', | ||
| children, | ||
| size, | ||
| variant, | ||
|
|
@@ -116,7 +129,8 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>( | |
| disabled, | ||
| onClick, | ||
| 'aria-disabled': ariaDisabled, | ||
| ...rest | ||
| form, | ||
| title, | ||
| }, | ||
| ref | ||
| ) => { | ||
|
|
@@ -126,11 +140,12 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>( | |
| 'visually-disabled': disabled, | ||
| })} | ||
| ref={ref} | ||
| type="button" | ||
| type={type} | ||
| onMouseDown={disabled ? noop : undefined} | ||
| onClick={disabled ? noop : onClick} | ||
| aria-disabled={disabled || ariaDisabled} | ||
| {...rest} | ||
| form={form} | ||
| title={title} | ||
| > | ||
| <> | ||
| {loading && <Spinner className="absolute" />} | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was going to make
icon?a separate boolean prop, but unless it put on all the relevant size styles, it would rely on the caller also passingsize="sm", which is stupid. And if it does put all the relevant size styles, it's a size. So I made it a size.