mars-v2-frontend/src/components/TextLink.tsx
Linkie Link 21268e5536
UI style updates (#106)
* feat: updates on the button styles

* env: updated yarn.lock

* fix: added account actions

* fix: updated the orbs logic

* fix: fixed the blur presets

* feat: updated the button logic

* fix: wallet modal style adjustments

* fix: updated close icon

* fix: fixed the close button

* fix: fix types

* fix: fixed the build

* tidy: component cleanup

* feat:  added new AccountDetails component

* refactor: propper usage of tailwind

* refactor: imports

* feat: added pages for all scenarios

* fix: fix the loading component

* fix: remove loading from default trade

* fix: fixed the build

* fix: fixed losing the provider on hotplug

* tidy: remove unused code

* fix: added error messages

* add borrow page structure

* env: enhanced debugging by restructuring the ENV object

* fix: fixed the build

* fix: fixed the wording on missing env variables

* feat: added button hover (#112)

* feat: added button hover

* fix: added bg transition to primary buttons

* feat: pages refactored (#111)

* feat: pages refactored

* fix: added loader for AccountNavigation

* fix: fixed the wallet store management

* fix: get rid of the walletSlice and refactor

* fix: added gap to the borrow page

* fix: fixed some dependencies

* fix: added initClients back

* fix: fixed according to feedback

---------

Co-authored-by: bwvdhelm <34470358+bobthebuidlr@users.noreply.github.com>
2023-03-08 10:44:39 +01:00

71 lines
1.8 KiB
TypeScript

import classNames from 'classnames'
import React, { LegacyRef, ReactNode } from 'react'
interface Props extends React.HTMLProps<HTMLAnchorElement> {
children?: string | ReactNode
className?: string
color?: 'primary' | 'secondary' | 'tertiary' | 'quaternary'
externalLink?: boolean
textSize?: 'small' | 'medium' | 'large'
text?: string | ReactNode
uppercase?: boolean
}
const colorClasses = {
primary:
'text-primary hover:text-secondary active:text-secondary/90 focus:text-text-secondary/90',
secondary: 'text-secondary hover:text-primary active:text-primary/90 focus:text-text-primary/90',
tertiary: 'text-white/80 hover:text-white active:text-white/90 focus:text-text-white/90',
quaternary: 'hover:text-white active:text-white',
}
const textSizeClasses = {
small: 'text-sm',
medium: 'text-base',
large: 'text-lg',
}
export const TextLink = React.forwardRef(function TextLink(
{
children,
className = '',
color = 'primary',
disabled,
externalLink,
href,
textSize = 'small',
text,
uppercase,
onClick,
...restProps
}: Props,
ref,
) {
return (
<a
className={classNames(
uppercase ? `${textSizeClasses[textSize]}-caps` : textSizeClasses[textSize],
colorClasses[color],
disabled && 'pointer-events-none opacity-50',
className,
)}
ref={ref as LegacyRef<HTMLAnchorElement>}
target={externalLink ? '_blank' : '_self'}
rel='noreferrer'
onClick={
onClick && !href
? (e) => {
e.preventDefault()
if (disabled) return
onClick
}
: undefined
}
href={!href ? '#' : href}
{...restProps}
>
{text && !children && text}
{children && children}
</a>
)
})