-
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.
add categories, change fav and style of site
- Loading branch information
ragudesign
committed
Jun 16, 2022
1 parent
0085399
commit 6fe6cdb
Showing
16 changed files
with
193 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
WORDPRESS_GRAPHQL_URL= | ||
NEXT_PUBLIC_WORDPRESS_GRAPHQL_URL= |
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,18 +1,16 @@ | ||
import Link from 'next/link' | ||
import { sanitiseExcerpt } from '../../lib/sanitise' | ||
import cardStyles from './Card.module.scss' | ||
import Link from 'next/link'; | ||
import { sanitiseExcerpt } from '../../lib/sanitise.js'; | ||
import cardStyles from './Card.module.scss'; | ||
|
||
const Card = (props) => { | ||
return ( | ||
<Link href={props.link} key={props.id}> | ||
<a className={cardStyles.card}> | ||
<h2>{props.title}</h2> | ||
{props.excerpt ? <div dangerouslySetInnerHTML={{ __html: sanitiseExcerpt(props.excerpt) }} /> : ''} | ||
</a> | ||
</Link> | ||
); | ||
}; | ||
|
||
return ( | ||
<Link href={props.link} key={props.id}> | ||
<a className={cardStyles.card}> | ||
<h2>{props.title}</h2> | ||
<div dangerouslySetInnerHTML={{ __html: sanitiseExcerpt(props.excerpt) }} /> | ||
</a> | ||
</Link> | ||
) | ||
|
||
} | ||
|
||
export default Card | ||
export default Card; |
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
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,17 +1,31 @@ | ||
import Header from '../components/header/Header' | ||
import NextNprogress from 'nextjs-progressbar'; | ||
import fetcher from '../lib/fetcher'; | ||
import '../styles/base/base.scss' | ||
import '../styles/base/gutenberg.scss' | ||
|
||
function MyApp({ Component, pageProps }) { | ||
function MyApp({ Component, pageProps, kbCats }) { | ||
|
||
return ( | ||
<> | ||
<NextNprogress color="#0770ef" /> | ||
<Header /> | ||
<Header kbCats={kbCats} /> | ||
<Component {...pageProps} /> | ||
</> | ||
) | ||
} | ||
|
||
export default MyApp | ||
export default MyApp | ||
|
||
|
||
export async function getStaticProps() { | ||
const response = await fetcher(getCats); | ||
|
||
const kbCats = response.data.kbsTax.nodes; | ||
|
||
return { | ||
props: { | ||
kbCats, | ||
}, | ||
}; | ||
} |
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,55 @@ | ||
import Head from 'next/head'; | ||
import fetcher from '../../lib/fetcher'; | ||
import { getCats, getCatSlug } from '../../lib/api'; | ||
import Card from '../../components/card/Card'; | ||
import kbStyles from '../../styles/Kb.module.scss'; | ||
|
||
export default function categories({ singleCategory }) { | ||
return ( | ||
<> | ||
<Head> | ||
<title>{singleCategory.name}</title> | ||
</Head> | ||
|
||
<div className={kbStyles.title}> | ||
<div className="wrapper"> | ||
<h2>{singleCategory.name}</h2> | ||
<p>Category</p> | ||
</div> | ||
</div> | ||
|
||
<div className={kbStyles.pageWrapper}> | ||
<div className="wrapper"> | ||
{singleCategory.kbs.nodes.map((kb) => { | ||
return <Card link={'/kb/' + kb.slug} key={kb.id} title={kb.title} excerpt={kb.excerpt} />; | ||
})} | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export async function getStaticPaths() { | ||
const response = await fetcher(getCats); | ||
|
||
const catSlugs = response.data.kbsTax.nodes; | ||
|
||
return { | ||
paths: catSlugs.map((cat) => `/categories/${cat.slug}`), | ||
fallback: false, | ||
}; | ||
} | ||
|
||
export const getStaticProps = async ({ params }) => { | ||
const variables = { | ||
slug: params.slug, | ||
}; | ||
|
||
const response = await fetcher(getCatSlug, { variables }); | ||
|
||
return { | ||
props: { | ||
singleCategory: response.data.kbsTax.nodes[0], | ||
}, | ||
}; | ||
}; |
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
Binary file not shown.
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,15 +1,22 @@ | ||
.title { | ||
padding: 5rem 0rem; | ||
padding: 6rem 0rem; | ||
background: #f9fafc; | ||
h2 { | ||
font-weight: 700; | ||
font-size: 3.8rem; | ||
margin: 0; | ||
} | ||
p { | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.pageWrapper { | ||
margin-top: 4rem; | ||
a { | ||
color: $primary; | ||
&:hover { | ||
color: darken($primary, 10%); | ||
} | ||
} | ||
} |
Oops, something went wrong.