-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
222 additions
and
188 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import PropTypes from "prop-types"; | ||
import * as Styled from "./styles"; | ||
|
||
const AsideSection = ({ title, children, className }) => { | ||
return ( | ||
<Styled.Section {...{ className }}> | ||
{title && <Styled.Title>{title}</Styled.Title>} | ||
{children} | ||
</Styled.Section> | ||
); | ||
}; | ||
|
||
AsideSection.displayName = "Page.Aside.Section"; | ||
|
||
AsideSection.propTypes = { | ||
children: PropTypes.node, | ||
title: PropTypes.string, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default AsideSection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Section = styled.section``; | ||
|
||
export const Title = styled.h3` | ||
position: relative; | ||
padding-right: 1em; | ||
padding-bottom: 0.5em; | ||
margin-bottom: 0.5em; | ||
border-bottom: 8px solid var(--color-background-accent-aside); | ||
& svg { | ||
position: absolute; | ||
top: 4px; | ||
right: 0; | ||
display: block; | ||
width: 32px; | ||
height: 32px; | ||
padding: 8px; | ||
overflow: visible; | ||
background-color: var(--turquoise60); | ||
border-radius: 50%; | ||
fill: var(--white); | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import PropTypes from "prop-types"; | ||
import Link from "next/link"; | ||
import { useTranslation } from "react-i18next"; | ||
import AsideSection from "../Section"; | ||
import * as Styled from "./styles"; | ||
|
||
export default function Tags({ tags, rootHomeLink }) { | ||
const { t } = useTranslation(); | ||
|
||
if (!tags) return null; | ||
if (tags.length <= 0) return null; | ||
|
||
return ( | ||
<AsideSection title={t(`tags`)}> | ||
<Styled.TagList> | ||
{tags.map((tag, i) => { | ||
if (rootHomeLink?.uri && tag.slug) { | ||
return ( | ||
<Styled.Tag key={i}> | ||
<Link | ||
prefetch={false} | ||
href={`/${rootHomeLink?.uri}?search=${tag.slug}`} | ||
> | ||
{`#${tag.title}`} | ||
</Link> | ||
</Styled.Tag> | ||
); | ||
} | ||
})} | ||
</Styled.TagList> | ||
</AsideSection> | ||
); | ||
} | ||
|
||
Tags.displayName = "Page.Aside.Tags"; | ||
|
||
Tags.propTypes = { | ||
tags: PropTypes.array, | ||
rootHomeLink: PropTypes.object, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import styled from "styled-components"; | ||
|
||
export const TagList = styled.ul``; | ||
|
||
export const Tag = styled.li` | ||
display: inline-block; | ||
margin-inline-end: 1ch; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import PropTypes from "prop-types"; | ||
import Tags from "./Tags"; | ||
import * as Styled from "./styles"; | ||
|
||
const Aside = ({ children, tags = [], rootHomeLink }) => { | ||
return ( | ||
<Styled.Aside> | ||
{children} | ||
{tags.length > 0 && rootHomeLink && <Tags {...{ tags, rootHomeLink }} />} | ||
</Styled.Aside> | ||
); | ||
}; | ||
|
||
Aside.displayName = "Page.Aside"; | ||
|
||
Aside.propTypes = { | ||
children: PropTypes.node, | ||
tags: PropTypes.array, | ||
rootHomeLink: PropTypes.object, | ||
}; | ||
|
||
export default Aside; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import styled from "styled-components"; | ||
import AsideSection from "../../Section"; | ||
|
||
export const AsidePrimary = styled.div` | ||
h3 { | ||
&:first-of-type { | ||
border-bottom: 8px solid var(--turquoise60); | ||
svg { | ||
position: absolute; | ||
top: 4px; | ||
right: 0; | ||
display: block; | ||
width: 32px; | ||
height: 32px; | ||
padding: 8px; | ||
overflow: visible; | ||
background-color: var(--turquoise60); | ||
border-radius: 50%; | ||
fill: var(--white); | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export const MediaSection = styled(AsideSection)` | ||
& > a { | ||
display: block; | ||
margin-block-start: 1em; | ||
} | ||
`; |
Oops, something went wrong.