-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
506bda3
commit 03b4369
Showing
20 changed files
with
609 additions
and
602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
import * as Headless from '@headlessui/react' | ||
import { clsx } from 'clsx' | ||
import { Link } from '@remix-run/react' | ||
import * as Headless from '@headlessui/react'; | ||
import { clsx } from 'clsx'; | ||
import { Link } from '@remix-run/react'; | ||
|
||
const variants = { | ||
primary: clsx( | ||
'inline-flex items-center justify-center px-4 py-[calc(theme(spacing.2)-1px)]', | ||
'rounded-full border border-transparent bg-gray-950 shadow-md', | ||
'whitespace-nowrap text-base font-medium text-white', | ||
'data-[disabled]:bg-gray-950 data-[hover]:bg-gray-800 data-[disabled]:opacity-40', | ||
), | ||
secondary: clsx( | ||
'relative inline-flex items-center justify-center px-4 py-[calc(theme(spacing.2)-1px)]', | ||
'rounded-full border border-transparent bg-white/15 shadow-md ring-1 ring-[#D15052]/15', | ||
'after:absolute after:inset-0 after:rounded-full after:shadow-[inset_0_0_2px_1px_#ffffff4d]', | ||
'whitespace-nowrap text-base font-medium text-gray-950', | ||
'data-[disabled]:bg-white/15 data-[hover]:bg-white/20 data-[disabled]:opacity-40', | ||
), | ||
outline: clsx( | ||
'inline-flex items-center justify-center px-2 py-[calc(theme(spacing.[1.5])-1px)]', | ||
'rounded-lg border border-transparent shadow ring-1 ring-black/10', | ||
'whitespace-nowrap text-sm font-medium text-gray-950', | ||
'data-[disabled]:bg-transparent data-[hover]:bg-gray-50 data-[disabled]:opacity-40', | ||
), | ||
} | ||
primary: clsx( | ||
'inline-flex items-center justify-center px-4 py-[calc(theme(spacing.2)-1px)]', | ||
'rounded-full border border-transparent bg-gray-950 shadow-md', | ||
'whitespace-nowrap text-base font-medium text-white', | ||
'data-[disabled]:bg-gray-950 data-[hover]:bg-gray-800 data-[disabled]:opacity-40' | ||
), | ||
secondary: clsx( | ||
'relative inline-flex items-center justify-center px-4 py-[calc(theme(spacing.2)-1px)]', | ||
'rounded-full border border-transparent bg-white/15 shadow-md ring-1 ring-[#D15052]/15', | ||
'after:absolute after:inset-0 after:rounded-full after:shadow-[inset_0_0_2px_1px_#ffffff4d]', | ||
'whitespace-nowrap text-base font-medium text-gray-950', | ||
'data-[disabled]:bg-white/15 data-[hover]:bg-white/20 data-[disabled]:opacity-40' | ||
), | ||
outline: clsx( | ||
'inline-flex items-center justify-center px-2 py-[calc(theme(spacing.[1.5])-1px)]', | ||
'rounded-lg border border-transparent shadow ring-1 ring-black/10', | ||
'whitespace-nowrap text-sm font-medium text-gray-950', | ||
'data-[disabled]:bg-transparent data-[hover]:bg-gray-50 data-[disabled]:opacity-40' | ||
), | ||
}; | ||
|
||
type ButtonProps = { | ||
variant?: keyof typeof variants | ||
variant?: keyof typeof variants; | ||
} & ( | ||
| React.ComponentPropsWithoutRef<typeof Link> | ||
| (Headless.ButtonProps & { to?: undefined }) | ||
) | ||
| React.ComponentPropsWithoutRef<typeof Link> | ||
| (Headless.ButtonProps & { to?: undefined }) | ||
); | ||
|
||
export function Button({ | ||
variant = 'primary', | ||
className, | ||
...props | ||
variant = 'primary', | ||
className, | ||
...props | ||
}: ButtonProps) { | ||
className = clsx(className, variants[variant]) | ||
className = clsx(className, variants[variant]); | ||
|
||
if (typeof props.to === 'undefined') { | ||
return <Headless.Button {...props} className={className} /> | ||
} | ||
if (typeof props.to === 'undefined') { | ||
return <Headless.Button {...props} className={className} />; | ||
} | ||
|
||
return <Link {...props} className={className} /> | ||
} | ||
return <Link {...props} className={className} />; | ||
} |
Oops, something went wrong.