feat: update content

This commit is contained in:
ryanchristo 2026-11-18 10:56:55 -08:00
parent 5aef42e16f
commit f667a9468d
No known key found for this signature in database
34 changed files with 1014 additions and 5 deletions

View file

@ -1,7 +1,7 @@
'use client' 'use client'
import { Background, Footer, Header, Sidebar } from 'chora/components' import { Background, Footer, Header, Sidebar } from 'components'
import { MenuContextProvider, ThemeContextProvider } from 'chora/contexts' import { MenuContextProvider, ThemeContextProvider } from 'contexts'
import './globals.css' import './globals.css'

View file

@ -1,4 +1,4 @@
import { ArrowRight } from 'chora/components/icons' import { ArrowRight } from 'components/icons'
import { Metadata } from 'next' import { Metadata } from 'next'
import Link from 'next/link' import Link from 'next/link'

View file

@ -13,6 +13,7 @@ async function getResearchArtifacts() {
return [ return [
{ group: 'about', items: getArtifacts('about') }, { group: 'about', items: getArtifacts('about') },
{ group: 'concepts', items: getArtifacts('concepts') }, { group: 'concepts', items: getArtifacts('concepts') },
{ group: 'tutorials', items: getArtifacts('tutorials') },
] ]
} }

View file

@ -0,0 +1,33 @@
.page {
composes: page from '../../../../styles/page.css';
}
.banner {
composes: banner-document from '../../../../styles/banner.css';
}
.content {
composes: content-full from '../../../../styles/content.css';
}
.content h2,
.content h3,
.content h4 {
margin: 1em 0;
}
.content h4 {
font-weight: 400;
}
.content p {
margin: 1em 0;
padding: 0 !important;
}
.content pre {
background-color: rgba(150, 150, 150, 0.1);
border-radius: 1em;
margin: 1em 0;
padding: 1.5em;
}

View file

@ -0,0 +1,35 @@
import { Metadata } from 'next'
import { getArtifact, getArtifacts } from '@utils'
import styles from './page.module.css'
export const metadata: Metadata = {
title: 'chora studio | research',
}
export const generateStaticParams = () => {
return getArtifacts('tutorials')
}
const ArtifactPage = async ({ params }: any) => {
const artifact = await getArtifact('tutorials', params.id)
return (
<div className={styles.page}>
<div className={styles.banner}>
<div>
<p>{`author: ${artifact.author}`}</p>
<p>{`title: ${artifact.title}`}</p>
<p>{`description: ${artifact.description}`}</p>
<p>{`created: ${artifact.created.toDateString()}`}</p>
<p>{`updated: ${artifact.updated.toDateString()}`}</p>
</div>
</div>
<div className={styles.content}>
<div dangerouslySetInnerHTML={{ __html: artifact.content }} />
</div>
</div>
)
}
export default ArtifactPage

@ -1 +1 @@
Subproject commit 9e1988ceec80250b0e9ca6c940ebf9d37d276cb3 Subproject commit 0c7e7cda9a3a94515da59cbd40c694dd6b9d9d9c

BIN
bun.lockb Normal file → Executable file

Binary file not shown.

View file

@ -0,0 +1,30 @@
.background {
align-items: center;
display: flex;
height: 100vh;
justify-content: center;
position: fixed;
width: 100vw;
z-index: -1;
}
.background {
background: var(--background-primary);
}
.background img {
scale: 65%;
}
@media (max-width: 850px) {
.background img {
scale: 35%;
}
}
.background div {
background: var(--background-primary-transparent);
height: 100vh;
position: fixed;
width: 100vw;
}

24
components/Background.tsx Normal file
View file

@ -0,0 +1,24 @@
'use client'
import Image from 'next/image'
import * as React from 'react'
import { useContext } from 'react'
import darkBackground from '../assets/images/chora_dark.png'
import lightBackground from '../assets/images/chora_light.png'
import { ThemeContext } from '../contexts'
import styles from './Background.module.css'
const Background = () => {
const { darkTheme } = useContext(ThemeContext)
return (
<div className={styles.background}>
<Image alt="chora" src={darkTheme ? darkBackground : lightBackground} />
<div />
</div>
)
}
export default Background

View file

@ -0,0 +1,11 @@
.footer {
composes: footer from '../styles/footer.css';
}
.title {
composes: footer-title from '../styles/footer.css';
}
.list {
composes: footer-list from '../styles/footer.css';
}

57
components/Footer.tsx Normal file
View file

@ -0,0 +1,57 @@
'use client'
import Image from 'next/image'
import Link from 'next/link'
import * as React from 'react'
import { useContext } from 'react'
import choraDarkSmall from '../assets//images/chora_dark_small.png'
import choraLightSmall from '../assets//images/chora_light_small.png'
import { ThemeContext } from '../contexts'
import { ArrowUpRight } from './icons'
import styles from './Footer.module.css'
const Footer = ({ about, sections }: any) => {
const { darkTheme } = useContext(ThemeContext)
const currentYear = new Date().getFullYear()
return (
<footer className={styles.footer}>
<div style={{ display: 'none' }}>{darkTheme?.toString()}</div>
<div>
<div className={styles.title}>
<Image
alt="chora"
src={darkTheme ? choraDarkSmall : choraLightSmall}
/>
<h4>{`© ${currentYear} Chora Studio LLC`}</h4>
</div>
{about && (
<div className={styles.list}>
<h3>{about.title}</h3>
<div>{about.text}</div>
</div>
)}
{sections.map((section: any) => (
<div className={styles.list} key={section.title}>
<h3>{section.title}</h3>
<ul>
{section.items.map((item: any) => (
<li key={item.title}>
<Link href={item.link} target={item.target}>
{item.title}
{item.target && <ArrowUpRight />}
</Link>
</li>
))}
</ul>
</div>
))}
</div>
</footer>
)
}
export default Footer

View file

@ -0,0 +1,22 @@
.header {
composes: header from '../styles/header.css';
}
.menu {
composes: header-menu from '../styles/header.css';
}
.divider {
composes: header-divider from '../styles/header.css';
}
.button {
background: none;
}
@media (min-width: 850px) {
.buttonMobile {
composes: button;
display: none !important;
}
}

74
components/Header.tsx Normal file
View file

@ -0,0 +1,74 @@
'use client'
import Link from 'next/link'
import * as React from 'react'
import { useContext } from 'react'
import { MenuContext, ThemeContext } from '../contexts'
import { HeaderTitle } from '.'
import { ArrowUpRight, MenuIcon, ThemeIcon } from './icons'
import styles from './Header.module.css'
const Header = ({ title, items, showMenuButton, showMobileTitle }: any) => {
const { showMenu, setShowMenu } = useContext(MenuContext)
const { darkTheme, setDarkTheme } = useContext(ThemeContext)
const toggleMenu = () => {
if (showMenu) {
setShowMenu(false)
} else {
setShowMenu(true)
}
}
const toggleTheme = () => {
if (darkTheme) {
setDarkTheme(false)
} else {
setDarkTheme(true)
}
}
return (
<header className={styles.header}>
<div style={{ display: 'none' }}>{darkTheme?.toString()}</div>
<div>
{showMenuButton && (
<button className={styles.buttonMobile} onClick={toggleMenu}>
<MenuIcon darkTheme={darkTheme} />
</button>
)}
<HeaderTitle
darkTheme={darkTheme}
title={title}
showMobileTitle={showMobileTitle}
/>
<div className={styles.menu}>
<ul>
{items &&
items.map((item: any, i: number) =>
item === 'divider' ? (
<li key={i} className={styles.divider}>
{'|'}
</li>
) : (
<li key={item.title}>
<Link href={item.link} target={item.target}>
{item.title}
{item.target && <ArrowUpRight />}
</Link>
</li>
),
)}
</ul>
<button className={styles.button} onClick={toggleTheme}>
<ThemeIcon darkTheme={darkTheme} />
</button>
</div>
</div>
</header>
)
}
export default Header

View file

@ -0,0 +1,17 @@
.title {
composes: header-title from '../styles/header.css';
}
@media (max-width: 850px) {
.title {
display: none !important;
}
}
.mobileTitle {
composes: header-title from '../styles/header.css';
}
.headerTitleText {
composes: header-title-text from '../styles/header.css';
}

View file

@ -0,0 +1,26 @@
'use client'
import Image from 'next/image'
import Link from 'next/link'
import * as React from 'react'
import choraLogoDark from '../assets/images/chora_dark_small.png'
import choraLogoLight from '../assets/images/chora_light_small.png'
import styles from './HeaderTitle.module.css'
const HeaderTitle = ({ darkTheme, title, showMobileTitle }: any) => (
<div className={showMobileTitle ? styles.mobileTitle : styles.title}>
<Link href={(title && title.link) || '/'}>
<Image alt="chora" src={darkTheme ? choraLogoDark : choraLogoLight} />
<div className={styles.headerTitleText}>
{'chora '}
{title && title.titleX && (
<span style={{ opacity: '0.75' }}>{title.titleX}</span>
)}
</div>
</Link>
</div>
)
export default HeaderTitle

View file

@ -0,0 +1,35 @@
.sidebar {
composes: sidebar from '../styles/sidebar.css';
}
.mobileOnly {
composes: sidebar from '../styles/sidebar.css';
min-height: calc(100vh - var(--header-height));
width: 75vw;
}
/* cancel sidebar styling */
@media (max-width: 850px) {
.mobileOnly {
display: block !important;
}
}
@media (min-width: 850px) {
.mobileOnly {
display: none !important;
}
}
.active {
composes: sidebar-link-active from '../styles/sidebar.css';
}
.divider {
margin: 1em 0;
}
.button {
background: none;
color: var(--color-theme);
}

58
components/Sidebar.tsx Normal file
View file

@ -0,0 +1,58 @@
'use client'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
import * as React from 'react'
import { useContext, useEffect, useState } from 'react'
import { MenuContext } from '../contexts'
import { ArrowUpRight } from './icons'
import styles from './Sidebar.module.css'
const Sidebar = ({ items, mobileOnly }: any) => {
const currentRoute = usePathname()
const { showMenu, setShowMenu } = useContext(MenuContext)
const [initRoute, setInitRoute] = useState<string>('')
useEffect(() => {
if (currentRoute && !initRoute) {
setInitRoute(currentRoute)
}
if (initRoute && initRoute !== currentRoute) {
setInitRoute(currentRoute)
setShowMenu(false)
}
}, [currentRoute, initRoute, setShowMenu])
return !mobileOnly || showMenu ? (
<div className={mobileOnly ? styles.mobileOnly : styles.sidebar}>
<ul>
{items.map((item: any, i: number) =>
item === 'divider' ? (
<hr key={i} className={styles.divider} />
) : (
<li key={item.title}>
<Link
href={item.link}
className={
currentRoute === item.link ? styles.active : undefined
}
target={item.target}
>
{item.title}
{item.target === '_blank' && <ArrowUpRight />}
</Link>
</li>
),
)}
</ul>
</div>
) : (
<></>
)
}
export default Sidebar

View file

@ -0,0 +1,54 @@
'use client'
import * as React from 'react'
import { useContext } from 'react'
import { ThemeContext } from '../../contexts'
const defaultColor = '#00C3A5'
const ArrowRight = ({ color, useTheme }: any) => {
const { darkTheme } = useContext(ThemeContext)
const stroke = color || defaultColor
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="0.5em"
width="0.5em"
viewBox="0 0 20 20"
style={{ marginRight: '0.5em' }}
>
<line
x1="3"
y1="10"
x2="17"
y2="10"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
<line
x1="3"
y1="10"
x2="7"
y2="15"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
<line
x1="3"
y1="10"
x2="7"
y2="5"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
</svg>
)
}
export default ArrowRight

View file

@ -0,0 +1,54 @@
'use client'
import * as React from 'react'
import { useContext } from 'react'
import { ThemeContext } from '../../contexts'
const defaultColor = '#00C3A5'
const ArrowRight = ({ color, useTheme }: any) => {
const { darkTheme } = useContext(ThemeContext)
const stroke = color || defaultColor
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="0.5em"
width="0.5em"
viewBox="0 0 20 20"
style={{ marginLeft: '0.5em' }}
>
<line
x1="3"
y1="10"
x2="17"
y2="10"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
<line
x1="17"
y1="10"
x2="12"
y2="5"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
<line
x1="17"
y1="10"
x2="12"
y2="15"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
</svg>
)
}
export default ArrowRight

View file

@ -0,0 +1,54 @@
'use client'
import * as React from 'react'
import { useContext } from 'react'
import { ThemeContext } from '../../contexts'
const defaultColor = '#00C3A5'
const ArrowUpRight = ({ color, useTheme }: any) => {
const { darkTheme } = useContext(ThemeContext)
const stroke = color || defaultColor
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="0.5em"
width="0.5em"
viewBox="0 0 20 20"
style={{ marginLeft: '0.5em' }}
>
<line
x1="3"
y1="17"
x2="17"
y2="3"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
<line
x1="17"
y1="3"
x2="7"
y2="3"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
<line
x1="17"
y1="3"
x2="17"
y2="12"
stroke={useTheme ? (darkTheme ? '#000' : '#FFF') : stroke}
strokeLinecap="round"
strokeWidth="3"
/>
</svg>
)
}
export default ArrowUpRight

View file

@ -0,0 +1,31 @@
import * as React from 'react'
const CheckIcon = ({ darkTheme }: any) => (
<svg
xmlns="http://www.w3.org/2000/svg"
height="0.5em"
width="0.5em"
viewBox="0 0 20 20"
>
<line
x1="7"
y1="17"
x2="17"
y2="3"
stroke={darkTheme ? '#FFFFFF' : '#111111'}
strokeLinecap="round"
strokeWidth="6"
/>
<line
x1="7"
y1="17"
x2="3"
y2="10"
stroke={darkTheme ? '#FFFFFF' : '#111111'}
strokeLinecap="round"
strokeWidth="6"
/>
</svg>
)
export default CheckIcon

View file

@ -0,0 +1,40 @@
import * as React from 'react'
const MenuIcon = ({ darkTheme }: any) => (
<svg
xmlns="http://www.w3.org/2000/svg"
height="1.5em"
width="1.5em"
viewBox="0 0 100 100"
>
<line
x1="10"
y1="85"
x2="90"
y2="85"
stroke={darkTheme ? '#FFFFFF' : '#111111'}
strokeLinecap="round"
strokeWidth="10"
/>
<line
x1="10"
y1="50"
x2="90"
y2="50"
stroke={darkTheme ? '#FFFFFF' : '#111111'}
strokeLinecap="round"
strokeWidth="10"
/>
<line
x1="10"
y1="15"
x2="90"
y2="15"
stroke={darkTheme ? '#FFFFFF' : '#111111'}
strokeLinecap="round"
strokeWidth="10"
/>
</svg>
)
export default MenuIcon

View file

@ -0,0 +1,15 @@
import * as React from 'react'
const ThemeIcon = ({ darkTheme }: any) => (
<svg
xmlns="http://www.w3.org/2000/svg"
height="1.5em"
width="1.5em"
viewBox="0 0 100 100"
>
<circle cx="50" cy="50" r="40" fill={darkTheme ? '#F5F5F5' : '#0A0A0A'} />
<circle cx="60" cy="50" r="37" fill={darkTheme ? '#111111' : '#FFFFFF'} />
</svg>
)
export default ThemeIcon

View file

@ -0,0 +1,17 @@
import * as React from 'react'
const UserIcon = ({ darkTheme }: any) => (
<svg
xmlns="http://www.w3.org/2000/svg"
height="1.5em"
width="1.5em"
viewBox="0 0 100 100"
>
<circle cx="50" cy="40" r="30" fill={darkTheme ? '#FFFFFF' : '#111111'} />
<circle cx="48" cy="40" r="22" fill={darkTheme ? '#111111' : '#FFFFFF'} />
<circle cx="50" cy="105" r="40" fill={darkTheme ? '#FFFFFF' : '#111111'} />
<circle cx="48" cy="105" r="32" fill={darkTheme ? '#111111' : '#FFFFFF'} />
</svg>
)
export default UserIcon

View file

@ -0,0 +1,7 @@
export { default as ArrowLeft } from './ArrowLeft'
export { default as ArrowRight } from './ArrowRight'
export { default as ArrowUpRight } from './ArrowUpRight'
export { default as CheckIcon } from './CheckIcon'
export { default as MenuIcon } from './MenuIcon'
export { default as ThemeIcon } from './ThemeIcon'
export { default as UserIcon } from './UserIcon'

5
components/index.ts Normal file
View file

@ -0,0 +1,5 @@
export { default as Background } from './Background'
export { default as Footer } from './Footer'
export { default as Header } from './Header'
export { default as HeaderTitle } from './HeaderTitle'
export { default as Sidebar } from './Sidebar'

26
contexts/MenuContext.tsx Normal file
View file

@ -0,0 +1,26 @@
'use client'
import * as React from 'react'
import { createContext, useState } from 'react'
const MenuContext = createContext<any>({})
const MenuContextProvider = (props: any) => {
const [showMenu, setShowMenu] = useState<boolean>(false)
const [showUser, setShowUser] = useState<boolean>(false)
return (
<MenuContext.Provider
value={{
showMenu,
setShowMenu,
showUser,
setShowUser,
}}
>
{props.children}
</MenuContext.Provider>
)
}
export { MenuContext, MenuContextProvider }

56
contexts/ThemeContext.tsx Normal file
View file

@ -0,0 +1,56 @@
'use client'
import * as React from 'react'
import { createContext, useEffect, useState } from 'react'
export const cachedDarkKey = 'chora-web-dark'
const initDarkTheme = () => {
let initDarkTheme = false
if (
typeof localStorage !== 'undefined' &&
localStorage.getItem(cachedDarkKey)
) {
initDarkTheme = localStorage.getItem(cachedDarkKey) === 'true'
} else if (typeof window !== 'undefined') {
initDarkTheme = window.matchMedia('(prefers-color-scheme: dark)').matches
}
return initDarkTheme
}
const ThemeContext = createContext<any>({})
const ThemeContextProvider = (props: any) => {
const [darkTheme, setDarkTheme] = useState<boolean>(initDarkTheme())
useEffect(() => {
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
const root = window.document.documentElement
if (darkTheme) {
root.classList.add('dark-theme')
root.style.backgroundColor = '#161616' // --background-secondary (dark-theme)
} else {
root.classList.remove('dark-theme')
root.style.backgroundColor = '#FCFCFC' // --background-secondary (light-theme)
}
localStorage.setItem(cachedDarkKey, darkTheme ? 'true' : 'false')
}
}, [darkTheme])
return (
<ThemeContext.Provider
value={{
darkTheme,
setDarkTheme,
}}
>
{props.children}
</ThemeContext.Provider>
)
}
export { ThemeContext, ThemeContextProvider }

4
contexts/index.ts Normal file
View file

@ -0,0 +1,4 @@
'use client'
export { MenuContext, MenuContextProvider } from './MenuContext'
export { ThemeContext, ThemeContextProvider } from './ThemeContext'

View file

@ -56,7 +56,6 @@
.content ul { .content ul {
list-style-position: inside; list-style-position: inside;
margin: 0.5em 0 2em 0;
} }
.content li { .content li {

68
styles/footer.css Normal file
View file

@ -0,0 +1,68 @@
/* footer */
.footer {
background: var(--background-primary);
box-shadow: var(--box-shadow);
height: var(--footer-height);
overflow: hidden;
width: 100%;
}
.footer > div {
align-items: center;
display: flex;
height: inherit;
justify-content: center;
margin: 0 1em;
}
/* footer-title */
.footer-title {
margin: 0 4em;
}
.footer-title img {
display: block;
height: 120px;
margin: 0 auto 1em auto;
width: 120px;
}
@media (max-width: 850px) {
.footer-title img {
display: none;
}
}
.footer-title h4 {
display: block;
}
/* footer-list */
.footer-list {
font-size: 0.95em;
height: 160px;
margin: 0 2em;
max-width: 220px;
min-width: 140px;
}
@media (max-width: 850px) {
.footer-list {
display: none;
}
}
.footer-list h3 {
margin-bottom: 1em;
}
.footer-list ul {
margin: 0 0.5em;
}
.footer-list li {
margin: 0.75em;
}

95
styles/header.css Normal file
View file

@ -0,0 +1,95 @@
/* header */
.header {
background: var(--background-primary);
box-shadow: var(--box-shadow);
height: var(--header-height);
overflow: hidden;
position: fixed;
width: 100%;
z-index: 1;
}
.header > div {
display: flex;
height: inherit;
justify-content: space-between;
margin: 0 2em;
}
/* header-title */
.header-title {
align-items: center;
display: flex;
justify-content: center;
}
.header-title a {
align-items: center;
display: flex;
justify-content: center;
}
.header-title img {
height: 36px;
width: 36px;
}
@media (max-width: 850px) {
.header-title img {
height: 27px;
width: 27px;
}
}
.header-title-text {
color: var(--color-text);
font-size: 20px;
font-weight: 300; /* cancel link weight */
margin-left: 8px;
}
@media (max-width: 850px) {
.header-title-text {
font-size: 15px;
margin-left: 6px;
}
}
/* header-menu */
.header-menu {
display: flex;
height: var(--header-height);
}
@media (max-width: 850px) {
.header-menu > div {
display: none;
}
}
.header-menu ul {
align-items: center;
display: flex;
justify-content: center;
list-style: none inside none;
margin: 0 1em;
}
@media (max-width: 850px) {
.header-menu ul {
display: none;
}
}
.header-menu li {
margin: 0.6em;
}
/* header-divider */
.header-divider {
color: var(--color-theme);
}

59
styles/sidebar.css Normal file
View file

@ -0,0 +1,59 @@
/* sidebar */
.sidebar {
background: var(--background-primary);
box-shadow: var(--box-shadow);
height: calc(100vh - var(--header-height));
margin-top: var(--header-height);
overflow-y: scroll;
position: fixed;
scrollbar-width: none; /* hide scrollbar - Firefox */
width: var(--sidebar-width);
z-index: 1;
-ms-overflow-style: none; /* hide scrollbar - Internet Explorer 10+ */
}
.sidebar::-webkit-scrollbar {
display: none; /* hide scrollbar - Safari and Chrome */
}
.sidebar ul {
list-style: none;
}
.sidebar > ul {
padding: 1.5em;
}
@media (max-width: 850px) {
.sidebar > ul {
padding: 1em;
}
}
.sidebar > ul > li {
font-size: 1.2em;
padding: 0.75em 1.5em;
}
.sidebar > ul > ul {
margin-left: 1.75em;
}
.sidebar > ul > ul > li {
font-size: 1.1em;
padding: 0.65em 0.5em;
}
/* sidebar-active */
.sidebar-active {
font-weight: 500;
}
/* sidebar-breadcrumb */
.sidebar-breadcrumb a {
font-size: 0.85em;
margin-left: -0.5em;
}

View file

@ -20,6 +20,8 @@
} }
], ],
"paths": { "paths": {
"@components": ["components/index.ts"],
"@contexts": ["contexts/index.ts"],
"@utils": ["utils/index.ts"] "@utils": ["utils/index.ts"]
} }
}, },