This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
generated from Kuboczoch/next-popular-website-starter
-
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
12 changed files
with
359 additions
and
7 deletions.
There are no files selected for viewing
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,13 @@ | ||
import styled from '@emotion/styled' | ||
import theme from '../../assets/theme' | ||
|
||
const Columns = styled('div')<{ columns?: string }>` | ||
display: grid; | ||
grid-template-columns: ${(props) => props.columns ?? '1fr 1fr'}; | ||
@media (max-width: ${theme.breakpoints.md}) { | ||
grid-template-columns: 1fr; | ||
} | ||
` | ||
|
||
export default Columns |
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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import styled from '@emotion/styled' | ||
|
||
const TypographyP = styled('p')`` | ||
const TypographyP = styled('p')` | ||
font-size: 18px; | ||
` | ||
|
||
export default TypographyP |
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,54 @@ | ||
import { css } from '@emotion/css' | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
import { faFortAwesome } from '@fortawesome/free-brands-svg-icons' | ||
import React from 'react' | ||
import { IWarTeam } from '../../../../@types/generated/contentful' | ||
import theme from '../../../assets/theme' | ||
|
||
const WarTeam = (props: IWarTeam) => ( | ||
<div | ||
className={css` | ||
display: flex; | ||
flex-direction: column; | ||
`} | ||
> | ||
<span | ||
className={css` | ||
position: relative; | ||
text-align: center; | ||
padding: 4px 16px 6px; | ||
margin: 0 auto; | ||
&::after { | ||
position: absolute; | ||
content: ''; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
height: 1px; | ||
background: ${theme.colors.warSecondary}; | ||
opacity: 0.25; | ||
} | ||
`} | ||
> | ||
<FontAwesomeIcon icon={faFortAwesome} style={{ marginRight: '4px' }} /> | ||
{props.fields.title} | ||
</span> | ||
<div | ||
className={css` | ||
display: flex; | ||
column-gap: 8px; | ||
row-gap: 8px; | ||
justify-content: center; | ||
margin: 18px 0; | ||
flex-wrap: wrap; | ||
`} | ||
> | ||
{props.fields.members.map((member) => ( | ||
<span key={member}>{member}</span> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
|
||
export default WarTeam |
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,138 @@ | ||
import { documentToReactComponents } from '@contentful/rich-text-react-renderer' | ||
import { css } from '@emotion/css' | ||
import React from 'react' | ||
|
||
import { IWarTeamsPageProps } from '../../pages/teams' | ||
import { IWarTeamsPageStateProps } from './useWarTeamsPage' | ||
|
||
import ContentPage from '../../components/blocks/ContentPage' | ||
import PageNavigation from '../../components/elements/PageNavigation' | ||
import options from '../../assets/configs/contentfulRichTextOptions' | ||
import Columns from '../../components/elements/Columns' | ||
import WarTeam from '../../components/elements/WarTeam' | ||
import { TypographyP } from '../../components/elements/Typography' | ||
import DesktopContainer from '../../components/elements/DesktopContainer' | ||
import MobileContainer from '../../components/elements/MobileContainer' | ||
import theme from '../../assets/theme' | ||
|
||
interface IWarTeamsPageViewProps extends IWarTeamsPageProps, IWarTeamsPageStateProps {} | ||
|
||
const WarTeamsPageView = (props: IWarTeamsPageViewProps) => ( | ||
<ContentPage> | ||
<ContentPage.Container> | ||
<PageNavigation | ||
contentPages={props.layout.fields.contentPages} | ||
activePage={props.contentPage} | ||
/> | ||
<ContentPage.DocumentContainer> | ||
<ContentPage.Title>{props.contentPage.fields.title}</ContentPage.Title> | ||
{documentToReactComponents(props.contentPage.fields.content, options)} | ||
<DesktopContainer breakpoint={theme.breakpoints.md}> | ||
<Columns | ||
className={css` | ||
position: relative; | ||
grid-column-gap: 16px; | ||
grid-row-gap: 8px; | ||
&::after { | ||
position: absolute; | ||
content: ''; | ||
top: 0; | ||
bottom: 0; | ||
right: calc(50% - (1px / 2)); | ||
width: 1px; | ||
background: ${theme.colors.warSecondary}; | ||
opacity: 0.25; | ||
@media (max-width: ${theme.breakpoints.md}) { | ||
display: none; | ||
} | ||
} | ||
`} | ||
> | ||
<TypographyP | ||
className={css` | ||
text-align: center; | ||
font-size: 24px; | ||
`} | ||
> | ||
{props.warTeamsPage.fields.groupAName} | ||
</TypographyP> | ||
<TypographyP | ||
className={css` | ||
text-align: center; | ||
font-size: 24px; | ||
`} | ||
> | ||
{props.warTeamsPage.fields.groupBName} | ||
</TypographyP> | ||
{Array.from( | ||
Array( | ||
props.warTeamsPage.fields.groupA.length > props.warTeamsPage.fields.groupB.length | ||
? props.warTeamsPage.fields.groupA.length | ||
: props.warTeamsPage.fields.groupB.length | ||
).keys() | ||
).map((id) => ( | ||
<React.Fragment key={id}> | ||
{(props.warTeamsPage.fields.groupA[id] && ( | ||
<WarTeam key={id + 'a'} {...props.warTeamsPage.fields.groupA[id]} /> | ||
)) ?? <div />} | ||
{(props.warTeamsPage.fields.groupB[id] && ( | ||
<WarTeam key={id + 'b'} {...props.warTeamsPage.fields.groupB[id]} /> | ||
)) ?? <div />} | ||
</React.Fragment> | ||
))} | ||
</Columns> | ||
</DesktopContainer> | ||
<MobileContainer> | ||
<Columns | ||
className={css` | ||
position: relative; | ||
grid-column-gap: 16px; | ||
grid-row-gap: 64px; | ||
`} | ||
> | ||
<Columns | ||
columns={'1fr'} | ||
className={css` | ||
grid-row-gap: 8px; | ||
`} | ||
> | ||
<TypographyP | ||
className={css` | ||
text-align: center; | ||
font-size: 24px; | ||
`} | ||
> | ||
{props.warTeamsPage.fields.groupAName} | ||
</TypographyP> | ||
{props.warTeamsPage.fields.groupA?.map((team) => ( | ||
<WarTeam key={team.sys.id} {...team} /> | ||
))} | ||
</Columns> | ||
<Columns | ||
columns={'1fr'} | ||
className={css` | ||
grid-row-gap: 8px; | ||
`} | ||
> | ||
<TypographyP | ||
className={css` | ||
text-align: center; | ||
font-size: 24px; | ||
`} | ||
> | ||
{props.warTeamsPage.fields.groupBName} | ||
</TypographyP> | ||
{props.warTeamsPage.fields.groupB?.map((team) => ( | ||
<WarTeam key={team.sys.id} {...team} /> | ||
))} | ||
</Columns> | ||
</Columns> | ||
</MobileContainer> | ||
</ContentPage.DocumentContainer> | ||
</ContentPage.Container> | ||
</ContentPage> | ||
) | ||
|
||
export default WarTeamsPageView |
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,13 @@ | ||
import React from 'react' | ||
|
||
import { IWarTeamsPageProps } from '../../pages/teams' | ||
|
||
import useWarTeamsPage from './useWarTeamsPage' | ||
import WarTeamsPageView from './WarTeamsPageView' | ||
|
||
const WarTeamsPage = (props: IWarTeamsPageProps) => { | ||
const state = useWarTeamsPage(props) | ||
return <WarTeamsPageView {...props} {...state} /> | ||
} | ||
|
||
export default WarTeamsPage |
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,10 @@ | ||
import { IWarTeamsPageProps } from '../../pages/teams' | ||
|
||
export interface IWarTeamsPageStateProps {} | ||
|
||
const useWarTeamsPage = (props: IWarTeamsPageProps): IWarTeamsPageStateProps => { | ||
console.log(props) | ||
return {} | ||
} | ||
|
||
export default useWarTeamsPage |
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,44 @@ | ||
import React from 'react' | ||
|
||
import Layout from '../components/elements/Layout' | ||
import WarTeamsPage from '../containers/WarTeamsPage' | ||
import getLayoutData, { ILayoutData } from '../utils/contentful/models/getLayoutData' | ||
import getContentPageData, { IContentPageData } from '../utils/contentful/models/getContentPageData' | ||
import getCoordinatesData, { ICoordinatesData } from '../utils/contentful/models/getCoordinatesData' | ||
import getWarTeamsPageData, { | ||
IWarTeamsPageData | ||
} from '../utils/contentful/models/getWarTeamsPageData' | ||
|
||
export interface IWarTeamsPageProps | ||
extends ILayoutData, | ||
IContentPageData, | ||
ICoordinatesData, | ||
IWarTeamsPageData {} | ||
|
||
const CoordinatesCalculation = (props: IWarTeamsPageProps) => ( | ||
<Layout | ||
{...props} | ||
title={`${props.contentPage?.fields.title} | ${props.layout.fields.projectNameShort}`} | ||
metaTags={props.contentPage.fields.metaTags} | ||
> | ||
<WarTeamsPage {...props} /> | ||
</Layout> | ||
) | ||
|
||
export const getStaticProps = async (): Promise<{ props: IWarTeamsPageProps }> => { | ||
const layout = await getLayoutData() | ||
const contentPage = await getContentPageData('teams') | ||
const coordinatesData = await getCoordinatesData() | ||
const warTeams = await getWarTeamsPageData() | ||
|
||
return { | ||
props: { | ||
...layout, | ||
...contentPage, | ||
...coordinatesData, | ||
...warTeams | ||
} | ||
} | ||
} | ||
|
||
export default CoordinatesCalculation |
Oops, something went wrong.
1246f14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: