mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 17:25:59 +02:00
content(resources): add link to GitHub
This commit is contained in:
@@ -7,5 +7,15 @@ export function ResourcesLink({
|
||||
}: PropsWithChildren<{
|
||||
to: string
|
||||
}>) {
|
||||
return <SC.ResourcesLinkWrapper to={to}>{children}</SC.ResourcesLinkWrapper>
|
||||
if (!to.match(/^(https?:\/\/)/)) {
|
||||
return (
|
||||
<SC.ResourcesLinkInternal to={to}>{children}</SC.ResourcesLinkInternal>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<SC.ResourcesLinkExternal href={to} target="_blank">
|
||||
{children}
|
||||
</SC.ResourcesLinkExternal>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Link } from "gatsby"
|
||||
import styled from "styled-components"
|
||||
import styled, { css } from "styled-components"
|
||||
|
||||
export const ResourcesLinkWrapper = styled(Link)`
|
||||
const linkStyle = css`
|
||||
color: #0090d8;
|
||||
font-weight: 700;
|
||||
border-bottom: 2px solid;
|
||||
@@ -14,3 +14,11 @@ export const ResourcesLinkWrapper = styled(Link)`
|
||||
transition: none;
|
||||
}
|
||||
`
|
||||
|
||||
export const ResourcesLinkInternal = styled(Link)`
|
||||
${linkStyle}
|
||||
`
|
||||
|
||||
export const ResourcesLinkExternal = styled.a`
|
||||
${linkStyle}
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user