mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 16:49:41 +00:00
refactor(link): add row presentation variant
This commit is contained in:
committed by
Carlos Valente
parent
9e42f18299
commit
f0c284b708
@@ -21,4 +21,15 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
box-shadow: 0 1px 0 0 currentColor;
|
box-shadow: 0 1px 0 0 currentColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover .icon,
|
||||||
|
&:focus-visible .icon {
|
||||||
|
transform: translateX(0.25rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
flex: 0 0 1.5em;
|
||||||
|
font-size: 1em;
|
||||||
|
transition: transform $transition-time-action;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { MouseEvent, ReactNode } from 'react';
|
import { MouseEvent, ReactNode } from 'react';
|
||||||
import { IoOpenOutline } from 'react-icons/io5';
|
import { HiArrowLongRight } from 'react-icons/hi2';
|
||||||
|
|
||||||
import { openLink } from '../../../utils/linkUtils';
|
import { openLink } from '../../../utils/linkUtils';
|
||||||
import { cx } from '../../../utils/styleUtils';
|
import { cx } from '../../../utils/styleUtils';
|
||||||
@@ -10,9 +10,10 @@ interface ExternalLinkProps {
|
|||||||
href: string;
|
href: string;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
inline?: boolean;
|
inline?: boolean;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ExternalLink({ href, inline, children }: ExternalLinkProps) {
|
export default function ExternalLink({ href, inline, className, children }: ExternalLinkProps) {
|
||||||
const handleClick = (event: MouseEvent) => {
|
const handleClick = (event: MouseEvent) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
openLink(href);
|
openLink(href);
|
||||||
@@ -23,10 +24,11 @@ export default function ExternalLink({ href, inline, children }: ExternalLinkPro
|
|||||||
href='#!'
|
href='#!'
|
||||||
target='_blank'
|
target='_blank'
|
||||||
rel='noreferrer'
|
rel='noreferrer'
|
||||||
className={cx([style.link, inline && style.inline])}
|
className={cx([style.link, inline && style.inline, className])}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
{children} <IoOpenOutline style={{ fontSize: '1em' }} />
|
{children}
|
||||||
|
<HiArrowLongRight className={style.icon} />
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user