-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pages: introduce pages in next.js dir layout (#1273)
* pages: introduce pages in next.js dir layout * pages: basic layout for desktop and mobile on text page * pages: added /about, /share/about, /share/about/conway, /blog and first post * pages: add link to share from blog post
- Loading branch information
1 parent
77f8aee
commit 69a452b
Showing
18 changed files
with
503 additions
and
45 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
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
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,7 @@ | ||
import React, {ReactElement} from 'react' | ||
|
||
|
||
/** @return {ReactElement} */ | ||
export default function AboutLayout() { | ||
return (<div>Hello About Layout!</div>) | ||
} |
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,20 @@ | ||
import React, {ReactElement} from 'react' | ||
import {assertDefined} from '../utils/assert' | ||
import TitledLayout from './TitledLayout' | ||
|
||
|
||
/** | ||
* Layout for blog posts. | ||
* | ||
* @property {string} title Page title | ||
* @property {Array<ReactElement>} children The text content elements for the page | ||
* @return {ReactElement} | ||
*/ | ||
export default function BlogLayout({title, children}) { | ||
assertDefined(title, children) | ||
return ( | ||
<TitledLayout title={title}> | ||
{children} | ||
</TitledLayout> | ||
) | ||
} |
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,23 @@ | ||
import React, {ReactElement} from 'react' | ||
import Typography from '@mui/material/Typography' | ||
import {assertDefined} from '../utils/assert' | ||
import TitledLayout from './TitledLayout' | ||
|
||
|
||
/** | ||
* Layout for blog posts. | ||
* | ||
* @property {string} title Page title | ||
* @property {string} dateline Page title | ||
* @property {Array<ReactElement>} children The text content elements for the page | ||
* @return {ReactElement} | ||
*/ | ||
export default function BlogPostLayout({title, dateline, children}) { | ||
assertDefined(title, dateline, children) | ||
return ( | ||
<TitledLayout title={title}> | ||
<Typography variant='h2'>{dateline}</Typography> | ||
{children} | ||
</TitledLayout> | ||
) | ||
} |
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,59 @@ | ||
import React, {ReactElement} from 'react' | ||
import {Helmet} from 'react-helmet-async' | ||
import Link from '@mui/material/Link' | ||
import Paper from '@mui/material/Paper' | ||
import Typography from '@mui/material/Typography' | ||
import {LogoBWithDomain} from '../Components/Logo/Logo' | ||
import {assertDefined} from '../utils/assert' | ||
|
||
|
||
/** | ||
* Layout for blog posts and info pages. | ||
* | ||
* @property {string} title Page title | ||
* @property {Array<ReactElement>} children The text content elements for the page | ||
* @return {ReactElement} | ||
*/ | ||
export default function TitledLayout({title, children}) { | ||
assertDefined(title, children) | ||
return ( | ||
<> | ||
<Helmet> | ||
<title>{title}</title> | ||
</Helmet> | ||
<Paper variant='page-background' sx={{height: '100vh', overflowY: 'scroll'}}> | ||
<Paper | ||
variant='page' | ||
elevation={2} | ||
sx={{ | ||
width: {xs: '100%', md: '8rem'}, // Full width on mobile, fixed on desktop | ||
float: {xs: 'none', md: 'left'}, // No float on mobile, float on desktop | ||
margin: {xs: '0 0 1rem 0', md: '0 1rem 1rem 0'}, // Margin for wrapping | ||
}} | ||
> | ||
<Link href="/"><LogoBWithDomain sx={{width: '8rem', height: '8rem'}}/></Link> | ||
</Paper> | ||
<Paper | ||
variant='page' | ||
elevation={2} | ||
sx={{ | ||
'overflow': 'hidden', | ||
'& .MuiTypography-root': { | ||
margin: '1em 0', | ||
}, | ||
'& .MuiTypography-p': { | ||
textAlign: 'justify', | ||
}, | ||
'& .MuiTypography-p + .MuiTypography-p': { | ||
display: 'block', | ||
}, | ||
'margin': {xs: '0 0 1rem 0', md: '0 8rem 1rem 0'}, // Margin for wrapping | ||
}} | ||
> | ||
<Typography variant='h1'>{title}</Typography> | ||
{children} | ||
</Paper> | ||
</Paper> | ||
</> | ||
) | ||
} |
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,33 @@ | ||
import React, {ReactElement} from 'react' | ||
import Typography from '@mui/material/Typography' | ||
import TitledLayout from '../layouts/TitledLayout' | ||
|
||
|
||
/** @return {ReactElement} */ | ||
export default function About() { | ||
return ( | ||
<TitledLayout title='About Bldrs'> | ||
<Typography variant='p'> | ||
The Architecture, Engineering and Construction industries are trying to face | ||
challenging problems of the future with tools anchored in the past. Meanwhile, | ||
a new dynamic has propelled the Tech industry: online, collaborative, | ||
open development. | ||
</Typography> | ||
<Typography variant='p'> | ||
We can't imagine a future where building the rest of the world hasn't been | ||
transformed by these new ways of working. We are part of that transformation. | ||
</Typography> | ||
<Typography variant='p'> | ||
The key insights from Tech. Cross-functional online collaboration unlocks team flow, | ||
productivity and creativity. Your team extends outside of your organization and | ||
software developers are essential team members. An ecosystem of app Creators developing on | ||
a powerful operating system. Platform is the most scalable architecture. Open workspaces, | ||
open standards and open source code the most powerful way to work. Cooperation is the | ||
unfair advantage. | ||
</Typography> | ||
<Typography variant='p'> | ||
Build Every Thing Together | ||
</Typography> | ||
</TitledLayout> | ||
) | ||
} |
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 {render} from '@testing-library/react' | ||
import {HelmetThemeCtx} from '../Share.fixture' | ||
import About from './About' | ||
|
||
|
||
describe('About', () => { | ||
it('renders', () => { | ||
const {getByText} = render(<About/>, {wrapper: HelmetThemeCtx}) | ||
const title = getByText('About Bldrs') | ||
expect(title).toBeInTheDocument() | ||
}) | ||
}) |
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,16 @@ | ||
import React, {ReactElement} from 'react' | ||
import Link from '@mui/material/Link' | ||
import BlogLayout from '../../layouts/BlogLayout' | ||
|
||
|
||
/** @return {ReactElement} */ | ||
export default function BlogIndex() { | ||
return ( | ||
<BlogLayout title='Blog Posts'> | ||
2024-12-05: | ||
<Link href="/blog/2024-12-05-bldrs-announces-launch-of-share-and-the-conway-engine"> | ||
Bldrs Announces Launch of Share and the Conway Engine | ||
</Link> | ||
</BlogLayout> | ||
) | ||
} |
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,20 @@ | ||
import React from 'react' | ||
import {render} from '@testing-library/react' | ||
import {HelmetThemeCtx} from '../../Share.fixture' | ||
import BlogIndex from './BlogIndex' | ||
import Post20241205BldrsAnnouncesLaunchOfShareAndTheConwayEngine from | ||
'./Post20241205BldrsAnnouncesLaunchOfShareAndTheConwayEngine' | ||
|
||
|
||
describe('BlogIndex and Posts', () => { | ||
it('renders', () => { | ||
const {getByText} = render(<BlogIndex/>, {wrapper: HelmetThemeCtx}) | ||
const title = getByText('Blog Posts') | ||
expect(title).toBeInTheDocument() | ||
expect(getByText('Bldrs Announces Launch of Share and the Conway Engine')).toBeInTheDocument() | ||
}) | ||
it('Posts render', () => { | ||
const {getByText} = render(<Post20241205BldrsAnnouncesLaunchOfShareAndTheConwayEngine/>, {wrapper: HelmetThemeCtx}) | ||
expect(getByText('Bldrs Announces Launch of Share and the Conway Engine')).toBeInTheDocument() | ||
}) | ||
}) |
Oops, something went wrong.