feat(directory): add layout scaffold

This commit is contained in:
Haoyu Xu
2023-02-24 19:27:24 -05:00
parent 9c26de493a
commit e98bf8d7ea
18 changed files with 765 additions and 33 deletions

View File

@@ -1,20 +1,28 @@
import {
useState,
useEffect
useEffect,
useContext
} from 'react'
import './home.css'
import { TitleContext } from '@/context/useTitleContext';
export default function Home(props) {
const { title, setTitle } = useContext(TitleContext)
useEffect(() => {
fetch("/_assets/directory.json").then(res => res.json()).then(data => {
console.log(data)
})
}, [])
useEffect(() => {
setTitle('dynamic_compile')
}, [])
return (
<section>
<section>
1233
{title}
<button onClick={() => setTitle('123')}>123</button>
</section>
<section>
22s

View File

View File

@@ -0,0 +1,27 @@
import {
useState,
useEffect,
useContext
} from 'react'
import './news.css'
import { TitleContext } from '@/context/useTitleContext';
export default function News(props) {
const { title, setTitle } = useContext(TitleContext)
useEffect(() => {
setTitle('news')
}, [])
return (
<section>
<section>
1
<button onClick={() => setTitle('123')}>123</button>
</section>
<section>
2
</section>
</section>
)
}

View File

@@ -1,15 +1,23 @@
import {
useState,
useEffect
useEffect,
useContext
} from 'react'
import './operator.css'
import { TitleContext } from '@/context/useTitleContext';
export default function Operator(props) {
const { title, setTitle } = useContext(TitleContext)
useEffect(() => {
setTitle('Chen')
}, [])
return (
<section>
<section>
1
<button onClick={() => setTitle('123')}>123</button>
</section>
<section>
2