Skip to content

Commit

Permalink
feat: built and working
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Ellison committed May 21, 2023
1 parent 6489807 commit 55e14e0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 60 deletions.
5 changes: 1 addition & 4 deletions backend/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ export async function getAllFiles(filePath) {
} else {
const relativeFiles = files.map((file) => {
const relativePath = path.relative(process.cwd(), file)
if (path.basename(file) === 'index.md') {
return path.dirname(relativePath.replace(contentDir , ""))
} else {
return relativePath.replace(contentDir , "")
}

})
resolve(relativeFiles.filter(Boolean))
}
Expand Down
53 changes: 2 additions & 51 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,56 +39,6 @@ import {

import Topbar from '../components/TopBar';

// const Logo = styled("img")({
// display: "block",
// width: "auto",
// height: 30,
// });

// const HeroSection = styled('section')(({ theme }) => ({
// position: 'relative',
// minHeight: '100vh',
// display: 'flex',
// alignItems: 'center',
// justifyContent: 'center',
// textAlign: 'center',
// color: '#fff',
// '&::before': {
// content: '""',
// position: 'absolute',
// top: 0,
// left: 0,
// right: 0,
// bottom: 0,
// backgroundImage: 'url("/backgrounds/sheffield.jpg")',
// backgroundSize: 'cover',
// backgroundPosition: 'center',
// opacity: 0.6,
// },
// }));

// const Overlay = styled('div')({
// position: 'absolute',
// top: 0,
// left: 0,
// right: 0,
// bottom: 0,
// display: 'flex',
// alignItems: 'center',
// justifyContent: 'center',
// flexDirection: 'column',
// });

// const Section = styled('div')(({ theme }) => ({
// padding: theme.spacing(8),
// }));

// const Icon = styled('span')(({ theme }) => ({
// fontSize: 48,
// marginBottom: theme.spacing(2),
// }));



const SiteSection = ({ title, description, link }) => {

Expand Down Expand Up @@ -122,7 +72,8 @@ const LandingPage = () => {
{/* Hero Section */}
<section
style={{
// position: 'relative',
marginTop: '50px',
// // position: 'relative',
minHeight: '100vh',
display: 'flex',
// alignItems: 'center',
Expand Down
27 changes: 22 additions & 5 deletions pages/services/[[...parms]].js → pages/services/[[...parms]].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ export default function Page(content) {
unwrapImages: true,
value: defaultValue
})


useEffect(() => {
setConfig({ ...state, value: String(content.content) , pageParms: router.query })
setConfig({ ...state, value: String(content.content), pageParms: router.query })

}, []);

Expand Down Expand Up @@ -340,27 +340,44 @@ function DefaultView({


export async function getStaticPaths() {
let paths = [];
let pages = [];
let location = 'services';
try {
const files = await getAllFiles(location)

const pages = files.map((file) => {

if (file.endsWith('index.md') || file.endsWith('index.mdx')) {
const filepath = file.split('/');
filepath.pop();
const joinedPath = filepath.join('/');
return joinedPath;
} else {
return file
}
})

// console.log('getStaticPaths: ',pages )
return {
fallback: true,
paths: files
paths: pages
}
} catch (error) {
console.error(error)
return {
fallback: true,
paths: files
paths: pages
}
}


}

export async function getStaticProps(context) {

const location = 'services/' + context.params.parms.join('/') + '/index.mdx';
// console.log('getStaticProps: ',location )

try {
const content = await getFileContent(location) // Pass null or an empty string for filePath
return {
Expand Down

0 comments on commit 55e14e0

Please sign in to comment.