Button border fixes (#129)

* fix: fixed the glas borders

# Conflicts:
#	src/components/Card.tsx

* fix: fixed the Copy Address button and removed all borders from button classes
This commit is contained in:
Linkie Link 2023-03-22 12:24:52 +01:00 committed by GitHub
parent e3118004ce
commit 21d31c0f79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 29 deletions

View File

@ -19,17 +19,22 @@ interface Props {
icon?: ReactElement icon?: ReactElement
iconClassName?: string iconClassName?: string
hasSubmenu?: boolean hasSubmenu?: boolean
hasFocus?: boolean
} }
export const buttonColorClasses = { export const buttonColorClasses = {
primary: primary: 'gradient-primary-to-secondary hover:bg-white/20 active:bg-white/40 focus:bg-white/20',
'border-none gradient-primary-to-secondary hover:bg-white/20 active:bg-white/40 focus:bg-white/20',
secondary: secondary:
'border border-white/30 bg-transparent hover:bg-white/20 active:bg-white/40 focus:bg-white/20', 'border border-white/30 bg-transparent hover:bg-white/20 active:bg-white/40 focus:bg-white/20',
tertiary: tertiary: 'bg-white/10 hover:bg-white/20 active:bg-white/40 focus:bg-white/20',
'border border-transparent bg-white/10 hover:bg-white/20 active:bg-white/40 focus:bg-white/20', quaternary: 'bg-transparent text-white/60 hover:text-white ctive:text-white',
quaternary: }
'bg-transparent text-white/60 border-transparent hover:text-white hover:border-white active:text-white active:border-white',
const focusClasses = {
primary: 'bg-white/20',
secondary: 'bg-white/20',
tertiary: 'bg-white/20',
quaternary: 'text-white',
} }
const buttonBorderClasses = const buttonBorderClasses =
@ -42,11 +47,10 @@ const buttonGradientClasses = [
] ]
const buttonTransparentColorClasses = { const buttonTransparentColorClasses = {
primary: 'border-none hover:text-primary active:text-primary focus:text-primary', primary: 'hover:text-primary active:text-primary focus:text-primary',
secondary: 'border-none hover:text-secondary active:text-secondary focus:text-secondary', secondary: 'hover:text-secondary active:text-secondary focus:text-secondary',
tertiary: 'border-none hover:text-white/80 active:text-white/80 focus:text-white/80', tertiary: 'hover:text-white/80 active:text-white/80 focus:text-white/80',
quaternary: quaternary: 'text-white/60 hover:text-white active:text-white',
'border-none text-white/60 hover:text-white hover:border-white active:text-white active:border-white',
} }
const buttonRoundSizeClasses = { const buttonRoundSizeClasses = {
@ -73,11 +77,12 @@ export const buttonVariantClasses = {
round: 'rounded-full p-0', round: 'rounded-full p-0',
} }
function glowElement() { function glowElement(enableAnimations: boolean) {
return ( return (
<svg <svg
className={classNames( className={classNames(
'glow-container z-1 opacity-0 group-hover:animate-glow group-focus:animate-glow', enableAnimations && 'group-hover:animate-glow group-focus:animate-glow',
'glow-container z-1 opacity-0 ',
'pointer-events-none absolute inset-0 h-full w-full', 'pointer-events-none absolute inset-0 h-full w-full',
)} )}
> >
@ -108,6 +113,7 @@ export const Button = React.forwardRef(function Button(
icon, icon,
iconClassName, iconClassName,
hasSubmenu, hasSubmenu,
hasFocus,
}: Props, }: Props,
ref, ref,
) { ) {
@ -151,6 +157,7 @@ export const Button = React.forwardRef(function Button(
variant === 'solid' && color === 'tertiary' && buttonBorderClasses, variant === 'solid' && color === 'tertiary' && buttonBorderClasses,
variant === 'solid' && color === 'primary' && buttonGradientClasses, variant === 'solid' && color === 'primary' && buttonGradientClasses,
disabled && 'pointer-events-none opacity-50', disabled && 'pointer-events-none opacity-50',
hasFocus && focusClasses[color],
className, className,
)} )}
id={id} id={id}
@ -175,7 +182,7 @@ export const Button = React.forwardRef(function Button(
<ChevronDown /> <ChevronDown />
</span> </span>
)} )}
{variant === 'solid' && !isDisabled && glowElement()} {variant === 'solid' && !isDisabled && glowElement(enableAnimations)}
{showProgressIndicator && ( {showProgressIndicator && (
<CircularProgress size={size === 'small' ? 10 : size === 'medium' ? 12 : 18} /> <CircularProgress size={size === 'small' ? 10 : size === 'medium' ? 12 : 18} />
)} )}

View File

@ -15,8 +15,8 @@ export const Card = (props: Props) => {
<section <section
className={classNames( className={classNames(
props.className, props.className,
'relative z-1 flex max-w-full flex-col flex-wrap items-start overflow-hidden rounded-base border border-transparent bg-white/5', 'relative z-1 flex max-w-full flex-col flex-wrap items-start overflow-hidden rounded-base bg-white/5',
'before:content-[" "] before:absolute before:inset-0 before:z-[-1] before:rounded-base before:p-[1px] before:border-glas', 'before:content-[" "] before:absolute before:inset-0 before:-z-1 before:rounded-base before:p-[1px] before:border-glas',
)} )}
> >
{props.title && ( {props.title && (

View File

@ -136,23 +136,13 @@ export default function ConnectedButton() {
</Text> </Text>
<div className='flex w-full pt-1'> <div className='flex w-full pt-1'>
<Button <Button
icon={<Copy />} icon={isCopied ? <Check /> : <Copy />}
variant='transparent' variant='transparent'
className='mr-10 flex w-auto py-2' className='mr-10 flex w-auto py-2'
color='quaternary' color='quaternary'
onClick={setCopied} onClick={setCopied}
> text={isCopied ? 'Copied' : 'Copy Address'}
{isCopied ? ( />
<Text size='sm'>
Copied{' '}
<span className='ml-1 w-4'>
<Check />
</span>
</Text>
) : (
<Text size='sm'>Copy Address</Text>
)}
</Button>
<Button <Button
icon={<ExternalLink />} icon={<ExternalLink />}
variant='transparent' variant='transparent'