8 changed files with 72 additions and 25 deletions
@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
|
||||
{ |
||||
"files.eol": "\n", |
||||
"editor.detectIndentation": false, |
||||
"editor.formatOnSave": true |
||||
"editor.formatOnSave": false, |
||||
"editor.tabSize": 2 |
||||
} |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
import { Icon, Icons } from "components/Icon"; |
||||
import { Link as LinkRouter } from "react-router-dom"; |
||||
|
||||
interface IArrowLinkPropsBase { |
||||
linkText: string; |
||||
className?: string; |
||||
onClick?: () => void; |
||||
direction?: "left" | "right"; |
||||
} |
||||
|
||||
interface IArrowLinkPropsExternal extends IArrowLinkPropsBase { |
||||
url: string; |
||||
} |
||||
|
||||
interface IArrowLinkPropsInternal extends IArrowLinkPropsBase { |
||||
to: string; |
||||
} |
||||
|
||||
export type ArrowLinkProps = |
||||
| IArrowLinkPropsExternal |
||||
| IArrowLinkPropsInternal |
||||
| IArrowLinkPropsBase; |
||||
|
||||
export function ArrowLink(props: ArrowLinkProps) { |
||||
const direction = props.direction || "right"; |
||||
const isExternal = !!(props as IArrowLinkPropsExternal).url; |
||||
const isInternal = !!(props as IArrowLinkPropsInternal).to; |
||||
const content = ( |
||||
<span className="text-bink-600 hover:text-bink-700 group inline-flex cursor-pointer items-center space-x-1 font-bold active:scale-95"> |
||||
{direction === "left" ? ( |
||||
<span className="text-xl transition-transform group-hover:-translate-x-1"> |
||||
<Icon icon={Icons.ARROW_LEFT} /> |
||||
</span> |
||||
) : null} |
||||
<span className="flex-1">{props.linkText}</span> |
||||
{direction === "right" ? ( |
||||
<span className="text-xl transition-transform group-hover:translate-x-1"> |
||||
<Icon icon={Icons.ARROW_RIGHT} /> |
||||
</span> |
||||
) : null} |
||||
</span> |
||||
); |
||||
|
||||
if (isExternal) |
||||
return <a href={(props as IArrowLinkPropsExternal).url}>{content}</a>; |
||||
else if (isInternal) |
||||
return ( |
||||
<LinkRouter to={(props as IArrowLinkPropsInternal).to}>{content}</LinkRouter> |
||||
); |
||||
return ( |
||||
<span onClick={() => props.onClick && props.onClick()}>{content}</span> |
||||
); |
||||
} |
@ -1,2 +1,3 @@
@@ -1,2 +1,3 @@
|
||||
export const CORS_PROXY_URL = |
||||
"https://proxy-1.movie-web.workers.dev/?destination="; |
||||
export const CORS_PROXY_URL = "https://proxy-1.movie-web.workers.dev/?destination="; |
||||
export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; |
||||
export const GITHUB_LINK = "https://github.com/JamesHawkinss/movie-web"; |
||||
|
Loading…
Reference in new issue