Skip to content

Commit

Permalink
mdx!
Browse files Browse the repository at this point in the history
Co-authored-by: BRUHisbackbois <[email protected]>
  • Loading branch information
BrightTheBackpack and Scott170c committed Dec 6, 2024
1 parent fe7fa61 commit 59558e1
Show file tree
Hide file tree
Showing 11 changed files with 2,777 additions and 54 deletions.
76 changes: 76 additions & 0 deletions app/components/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/** @jsxImportSource theme-ui */
import { useState } from 'react';

const FAQItem = ({ question, answer }) => {
const [isOpen, setIsOpen] = useState(false);

return (
<div
sx={{
borderBottom: '1px solid #ddd',
padding: '16px 0',
}}
>
<button
onClick={() => setIsOpen(!isOpen)}
sx={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
width: '100%',
background: 'none',
border: 'none',
padding: 0,
fontSize: '18px',
fontWeight: 'bold',
color: '#333',
cursor: 'pointer',
textAlign: 'left',
':hover': {
color: '#0070f3',
},
}}
>
{question}
<span
sx={{
transform: isOpen ? 'rotate(90deg)' : 'rotate(0)',
transition: 'transform 0.2s',
}}
>
</span>
</button>
{isOpen && (
<p
sx={{
marginTop: '8px',
fontSize: '16px',
color: '#555',
lineHeight: 1.6,
}}
>
{answer}
</p>
)}
</div>
);
};

const FAQ = ({ items }) => {
return (
<div
sx={{
maxWidth: '600px',
margin: '0 auto',
padding: '16px',
}}
>
{items.map((item, index) => (
<FAQItem key={index} question={item.question} answer={item.answer} />
))}
</div>
);
};

export default FAQ;
Empty file removed app/guide/guide.md
Empty file.
1 change: 1 addition & 0 deletions app/guide/guideMD.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## This is a heading
38 changes: 19 additions & 19 deletions app/guide/page.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
"use client";
import { keyframes } from '@emotion/react'
import GuideMD from './guideMD.mdx'
import { MDXProvider } from '@mdx-js/react'

// import Image from "next/image";
import {
Box,
Button,
Image,
Flex,
Badge,
Container,
Grid,
Heading,
Text,
Card
} from 'theme-ui'
const fadeIn = keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })

import { Box } from 'theme-ui'
// const components = {
// h1: (props) => <Heading as="h1" {...props} />,
// h2: (props) => <Heading as="h2" {...props} />,
// h3: (props) => <Heading as="h3" {...props} />,
// p: (props) => <Text {...props} />,
// // Add more custom components as needed
// }
export default function guide() {
return (
<div>
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"></script>
</div>
);
}
<Box sx = {{
fontFamily: 'var(--font-inter)',
}}>
<MDXProvider >
<GuideMD />
</MDXProvider>
</Box>
);
}
66 changes: 40 additions & 26 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


/* eslint-disable @typescript-eslint/no-unused-vars */
import { keyframes } from '@emotion/react'
import { keyframes } from '@emotion/react';
// import '@google/model-viewer';
// import Script from 'next/script';
import { useEffect } from 'react';
Expand All @@ -29,6 +29,9 @@ const fall = ( rotationDirection: number) => keyframes`
transform: translateY(4700%) rotate(${rotationDirection * 360}deg);
}
`;

const faqItems = {question: 'What is Next.js?', answer: 'Next.js is a React framework for production.' };

export default function Home() {
useEffect(() => {
if (typeof window !== 'undefined') {
Expand All @@ -37,7 +40,7 @@ export default function Home() {
}, []);
return (
<Grid gap = {0} sx={{
backgroundImage: 'linear-gradient(to bottom, #25A8FF, #DCF1FF)',
backgroundImage: 'linear-gradient(#0099FF, #A5DBFF)',
}}>

<Box
Expand Down Expand Up @@ -173,13 +176,19 @@ export default function Home() {
fontSize: '1.5rem',
fontWeight: 900,
color: 'white',
bg: '#f90b0b',
backgroundImage: 'linear-gradient(to right, #eb3941, #f15e64, #e14e53, #e2373f);',
width: 'fit-content',
borderRadius: '1rem',
borderRadius: '3rem',
padding: '1rem 2rem',
mt: '1rem'
cursor: 'pointer',
mt: '1rem',
backgroundSize: '300% 100%',
transition: 'background 0.3s ease-in-out',
'&:hover': {
animation: `background-position: 100% 0; box-shadow: 0 5px 15px rgba(242, 97, 103, .4)`,
},
}}>
<b>Register Now!</b>
<b>Come Build with Us ➜</b>
</Button>


Expand All @@ -206,22 +215,22 @@ export default function Home() {
<Heading as="h3" sx={{
margin: 20,
fontFamily: 'var(--font-inter)',
fontSize: '2rem',
fontSize: '1.55vw',
fontWeight:800,
paddingTop: '0.5rem',
paddingLeft: '5rem',
paddingRight: '5rem',
color: 'white'
}}>Design a unique PCB decoration (all art made by you!) from scratch and submit it to the project gallery via a pull request in the GitHub repository before [set date]! <br></br>
}}>Design a unique PCB decoration from scratch and submit it to the project gallery via a pull request in the GitHub repository before [set date]! <br></br>
Once your PR gets approved, you can get your PCB decoration shipped just in time for the holidays!🎄</Heading>
<Grid columns= {[1,1,1,3]}gap = {[50,5,20,50]} sx={{
<Grid columns= {[1,1,1, 3]}gap = {[50,5,20,50]} sx={{
mt: '5vh',
width: 'auto',
textAlign: 'center',
justifyContent: 'center',
flexDirection: 'row',
alignItems: 'center',
backgroundColor: 'rgba(255, 255, 255, 40%)',
backgroundColor: 'rgba(255, 255, 255, 20%)',
borderRadius: '32px',
mx: '32px',
paddingBottom: '2vh',
Expand All @@ -232,19 +241,19 @@ export default function Home() {
justifyContent: 'center',
display: 'flex',
flexDirection: 'column',
paddingTop: '2rem'
paddingTop: '1.7rem'
}}>
<Heading as="h4" sx={{
fontFamily: 'var(--font-inter)',
fontWeight: 900,
fontSize: '1.5vw',
paddingBottom: '1.2rem'
} }>Design a Decoration</Heading>
} }>Design</Heading>
<Image sx={{
width:'30rem',
width:'28rem',
height:'30rem',
borderRadius: '16px',
paddingBottom: '3rem'
paddingBottom: '3rem',
}}></Image>

</Box>
Expand All @@ -253,16 +262,16 @@ export default function Home() {
justifyContent: 'center',
display: 'flex',
flexDirection: 'column',
paddingTop: '2rem'
paddingTop: '1.7rem'
}}>
<Heading as="h4" sx={{
fontFamily: 'var(--font-inter)',
fontWeight: 900,
fontSize: '1.5vw',
paddingBottom: '1.2rem'
} }>Code Firmware</Heading>
} }>Code</Heading>
<Image sx={{
width:'30rem',
width:'28rem',
height:'30rem',
borderRadius: '16px',
paddingBottom: '2.5rem'
Expand All @@ -273,16 +282,16 @@ export default function Home() {
justifyContent: 'center',
display: 'flex',
flexDirection: 'column',
paddingTop: '2rem'
paddingTop: '1.7rem'
}}>
<Heading as="h4" sx={{
fontFamily: 'var(--font-inter)',
fontWeight: 900,
fontSize: '1.5vw',
paddingBottom: '1.2rem'
} }>Submit a PR</Heading>
} }>Submit</Heading>
<Image sx={{
width:'30rem',
width:'28rem',
height:'30rem',
borderRadius: '16px',
paddingBottom: '2.5rem'
Expand All @@ -297,23 +306,29 @@ export default function Home() {
display: 'flex',
fontWeight: 900,
margin: '4vh',
paddingLeft: '-10vh'
}}>
Requirements:
</Heading>
<Heading sx={{

<Heading sx={{
textAlign: 'left',
fontFamily: 'var(--font-inter)',
fontWeight: 900,
margin: '2vh',
// display: 'flex',
// flexDirection: 'column',
ml: '4vh'
ml: '4vh',
color: 'black',
fontSize: '1.75vw',
overflow: 'hidden'
}}>
- Must be a student in high school or below </Heading>
FAQ:
</Heading>
<Box sx={{height: '5vw', width: '10vw',}}>Hello World</Box>
</Box>
<Box sx={{
backgroundColor: '#FFA5A5',
height: '250%',
height: '70%',
position: 'relative',
bottom: '0',
display: 'flex',
Expand All @@ -327,7 +342,6 @@ export default function Home() {
Made with ❤️ and ❄️ by Bright Li (@bright li) & Scott Chiang (@Scott)
</Box>
</Box>

</Grid>
);
}
15 changes: 15 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { MDXComponents } from 'mdx/types'
import { Heading, Text } from 'theme-ui'

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components,
h1: (props) => <Heading as="h1" sx={{ fontSize: 5, color: 'black' , fontFamily: 'var(--font-inter)',
}} {...props} />,
h2: (props) => <Heading as="h2" sx={{ fontSize: 4, color: 'black', fontFamily: 'var(--font-inter)',
}} {...props} />,
h3: (props) => <Heading as="h3" sx={{ fontSize: 3, color: 'black' }} {...props} />,
p: (props) => <Text sx={{ fontSize: 2, color: 'text' }} {...props} />,
// Add more custom components as needed
}
}
9 changes: 8 additions & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import type { NextConfig } from "next";
import createMDX from '@next/mdx'

const nextConfig: NextConfig = {
/* config options here */
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],

};

const withMDX = createMDX({
extension: /\.mdx?$/
})

export default nextConfig;
export default withMDX(nextConfig)
Loading

0 comments on commit 59558e1

Please sign in to comment.