diff --git a/app/globals.css b/app/globals.css index 0bdaae6..98f6280 100644 --- a/app/globals.css +++ b/app/globals.css @@ -1,145 +1,5 @@ -@font-face { - font-family: 'Ubuntu'; - font-style: normal; - font-weight: normal; - src: url('../public/font/Ubuntu-Regular.ttf'); -} - -@font-face { - font-family: 'Ubuntu'; - font-style: italic; - font-weight: normal; - src: url('../public/font/Ubuntu-Italic.ttf'); -} - -@font-face { - font-family: 'Ubuntu'; - font-style: normal; - font-weight: bold; - src: url('../public/font/Ubuntu-Bold.ttf'); -} - -@font-face { - font-family: 'Ubuntu'; - font-style: italic; - font-weight: bold; - src: url('../public/font/Ubuntu-BoldItalic.ttf'); -} - -@font-face { - font-family: 'Ubuntu'; - font-style: normal; - font-weight: 300; - src: url('../public/font/Ubuntu-Light.ttf'); -} - -@font-face { - font-family: 'Ubuntu'; - font-style: italic; - font-weight: 300; - src: url('../public/font/Ubuntu-LightItalic.ttf'); -} - -@font-face { - font-family: 'Ubuntu'; - font-style: normal; - font-weight: 500; - src: url('../public/font/Ubuntu-Medium.ttf'); -} - -@font-face { - font-family: 'Ubuntu'; - font-style: italic; - font-weight: 500; - src: url('../public/font/Ubuntu-MediumItalic.ttf'); -} - -:root { - --color-error: rgb(245, 45, 45); - --color-theme: rgb(0, 195, 165); - --font-family: 'Ubuntu', sans-serif; - --footer-height: 320px; - --header-height: 80px; - --sidebar-width: 240px; - --transition: 0.25s; - - /* light theme */ - --background-primary: rgb(255, 255, 255); - --background-primary-transparent: rgba(255, 255, 255, 0.98); - --background-secondary: rgb(250, 250, 250); - --background-secondary-transparent: rgba(250, 250, 250, 0.98); - --box-shadow: 0 0 4px rgb(245, 245, 245); - --box-shadow-color: rgb(245, 245, 245); - --color-text: rgb(10, 10, 10); - --color-text-placeholder: rgba(10, 10, 10, 0.5); -} +@import 'chora/styles/main.css'; .dark-theme { - --background-primary: rgb(17, 17, 17); - --background-primary-transparent: rgba(17, 17, 17, 0.98); - --background-secondary: rgb(22, 22, 22); - --background-secondary-transparent: rgba(22, 22, 22, 0.98); - --box-shadow: 0 0 4px rgb(27, 27, 27); - --box-shadow-color: rgb(27, 27, 27); - --color-text: rgb(245, 245, 245); - --color-text-placeholder: rgba(245, 245, 245, 0.5); -} - -* { - margin: 0; - padding: 0; -} - -html { - cursor: default; -} - -body { - font-family: var(--font-family); - font-weight: 300; - overflow-x: hidden; -} - -main { - color: var(--color-text); -} - -h1, -h2, -h3, -h4, -h5 { - font-weight: 400; -} - -p { - line-height: 1.75; -} - -a, -a:active { - color: var(--color-theme); - font-weight: 400; - text-decoration: none; - transition: var(--transition); -} - -a:hover { - opacity: 0.75; -} - -button { - background: var(--color-theme); - border: none; - border-radius: 1em; - color: var(--background-primary); - font-family: var(--font-family); - font-size: 1em; - outline: none; - transition: var(--transition); -} - -button:hover { - cursor: pointer; - opacity: 0.75; + composes: dark-theme from 'chora/styles/main.css'; } diff --git a/app/layout.tsx b/app/layout.tsx index dd1f8c4..9fe1463 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,4 +1,6 @@ -import { ThemeContextProvider } from '@contexts/ThemeContext' +'use client' + +import { ThemeContextProvider } from 'chora/contexts' import Footer from '@components/Footer' import Header from '@components/Header' diff --git a/bun.lockb b/bun.lockb index 0ba8f4a..89c5a31 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/Background.tsx b/components/Background.tsx index 6274ae1..ab081b3 100644 --- a/components/Background.tsx +++ b/components/Background.tsx @@ -1,8 +1,8 @@ 'use client' -import { ThemeContext } from '@contexts/ThemeContext' -import darkBackground from '../public/images/chora_dark.png' -import lightBackground from '../public/images/chora_light.png' +import { ThemeContext } from 'chora/contexts' +import darkBackground from 'chora/assets/images/chora_dark.png' +import lightBackground from 'chora/assets/images/chora_light.png' import Image from 'next/image' import { useContext } from 'react' diff --git a/components/Footer.tsx b/components/Footer.tsx index c7cecdf..7adc9e5 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -1,8 +1,8 @@ 'use client' -import { ThemeContext } from '@contexts/ThemeContext' -import choraLogoDark from '../public/images/chora_dark_small.png' -import choraLogoLight from '../public/images/chora_light_small.png' +import { ThemeContext } from 'chora/contexts' +import choraLogoDark from 'chora/assets//images/chora_dark_small.png' +import choraLogoLight from 'chora/assets//images/chora_light_small.png' import Image from 'next/image' import Link from 'next/link' import { useContext } from 'react' @@ -14,7 +14,7 @@ const Footer = () => { return (
-
{darkTheme.toString()}
+
{darkTheme?.toString()}
chora diff --git a/components/Header.module.css b/components/Header.module.css index 1fac84a..259f1c6 100644 --- a/components/Header.module.css +++ b/components/Header.module.css @@ -16,6 +16,10 @@ margin: 0 1em; } +.header button { + background: none; +} + /* title */ .title { diff --git a/components/Header.tsx b/components/Header.tsx index 535bea1..ab3a8f7 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,9 +1,9 @@ 'use client' -import { ThemeContext } from '@contexts/ThemeContext' -import choraLogoDark from '../public/images/chora_dark_small.png' -import choraLogoLight from '../public/images/chora_light_small.png' -import ThemeButton from '@components/ThemeButton' +import { ThemeContext } from 'chora/contexts' +import ThemeButton from 'chora/components/ThemeButton' +import choraLogoDark from 'chora/assets/images/chora_dark_small.png' +import choraLogoLight from 'chora/assets/images/chora_light_small.png' import Image from 'next/image' import Link from 'next/link' import { useContext } from 'react' @@ -23,7 +23,7 @@ const Header = () => { return (
-
{darkTheme.toString()}
+
{darkTheme?.toString()}
diff --git a/components/ThemeButton.module.css b/components/ThemeButton.module.css deleted file mode 100644 index ee23fc1..0000000 --- a/components/ThemeButton.module.css +++ /dev/null @@ -1,8 +0,0 @@ -.button { - align-items: center; - background: none; - display: inline-flex; - height: var(--header-height); - margin: 0; - padding: 0; -} diff --git a/components/ThemeButton.tsx b/components/ThemeButton.tsx deleted file mode 100644 index 52e4e87..0000000 --- a/components/ThemeButton.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as React from 'react' - -import styles from './ThemeButton.module.css' - -const ThemeButton = ({ darkTheme, toggleTheme }: any) => ( - -) - -export default ThemeButton diff --git a/contexts/ThemeContext.tsx b/contexts/ThemeContext.tsx deleted file mode 100644 index 3f1ee63..0000000 --- a/contexts/ThemeContext.tsx +++ /dev/null @@ -1,56 +0,0 @@ -'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({}) - -const ThemeContextProvider = (props: any) => { - const [darkTheme, setDarkTheme] = useState(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 = '#FAFAFA' // --background-secondary (light-theme) - } - - localStorage.setItem(cachedDarkKey, darkTheme ? 'true' : 'false') - } - }, [darkTheme]) - - return ( - - {props.children} - - ) -} - -export { ThemeContext, ThemeContextProvider } diff --git a/package.json b/package.json index c408188..7576907 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "clean": "rm -rf .next dist node_modules" }, "dependencies": { + "chora": "npm:@chora-io/chora@v0.1.0-alpha2", + "cosmos": "npm:@chora-io/cosmos@v0.1.0-alpha2", "next": "^14", "react": "^18", "react-dom": "^18" diff --git a/app/favicon.ico b/public/favicon.ico similarity index 100% rename from app/favicon.ico rename to public/favicon.ico diff --git a/public/font/UFL.txt b/public/font/UFL.txt deleted file mode 100644 index 6e722c8..0000000 --- a/public/font/UFL.txt +++ /dev/null @@ -1,96 +0,0 @@ -------------------------------- -UBUNTU FONT LICENCE Version 1.0 -------------------------------- - -PREAMBLE -This licence allows the licensed fonts to be used, studied, modified and -redistributed freely. The fonts, including any derivative works, can be -bundled, embedded, and redistributed provided the terms of this licence -are met. The fonts and derivatives, however, cannot be released under -any other licence. The requirement for fonts to remain under this -licence does not require any document created using the fonts or their -derivatives to be published under this licence, as long as the primary -purpose of the document is not to be a vehicle for the distribution of -the fonts. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this licence and clearly marked as such. This may -include source files, build scripts and documentation. - -"Original Version" refers to the collection of Font Software components -as received under this licence. - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to -a new environment. - -"Copyright Holder(s)" refers to all individuals and companies who have a -copyright ownership of the Font Software. - -"Substantially Changed" refers to Modified Versions which can be easily -identified as dissimilar to the Font Software by users of the Font -Software comparing the Original Version with the Modified Version. - -To "Propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification and with or without charging -a redistribution fee), making available to the public, and in some -countries other activities as well. - -PERMISSION & CONDITIONS -This licence does not grant any rights under trademark law and all such -rights are reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of the Font Software, to propagate the Font Software, subject to -the below conditions: - -1) Each copy of the Font Software must contain the above copyright -notice and this licence. These can be included either as stand-alone -text files, human-readable headers or in the appropriate machine- -readable metadata fields within text or binary files as long as those -fields can be easily viewed by the user. - -2) The font name complies with the following: -(a) The Original Version must retain its name, unmodified. -(b) Modified Versions which are Substantially Changed must be renamed to -avoid use of the name of the Original Version or similar names entirely. -(c) Modified Versions which are not Substantially Changed must be -renamed to both (i) retain the name of the Original Version and (ii) add -additional naming elements to distinguish the Modified Version from the -Original Version. The name of such Modified Versions must be the name of -the Original Version, with "derivative X" where X represents the name of -the new work, appended to that name. - -3) The name(s) of the Copyright Holder(s) and any contributor to the -Font Software shall not be used to promote, endorse or advertise any -Modified Version, except (i) as required by this licence, (ii) to -acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with -their explicit written permission. - -4) The Font Software, modified or unmodified, in part or in whole, must -be distributed entirely under this licence, and must not be distributed -under any other licence. The requirement for fonts to remain under this -licence does not affect any document created using the Font Software, -except any version of the Font Software extracted from a document -created using the Font Software may only be distributed under this -licence. - -TERMINATION -This licence becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER -DEALINGS IN THE FONT SOFTWARE. diff --git a/public/font/Ubuntu-Bold.ttf b/public/font/Ubuntu-Bold.ttf deleted file mode 100644 index 4af149a..0000000 Binary files a/public/font/Ubuntu-Bold.ttf and /dev/null differ diff --git a/public/font/Ubuntu-BoldItalic.ttf b/public/font/Ubuntu-BoldItalic.ttf deleted file mode 100644 index a68afb6..0000000 Binary files a/public/font/Ubuntu-BoldItalic.ttf and /dev/null differ diff --git a/public/font/Ubuntu-Italic.ttf b/public/font/Ubuntu-Italic.ttf deleted file mode 100644 index b022726..0000000 Binary files a/public/font/Ubuntu-Italic.ttf and /dev/null differ diff --git a/public/font/Ubuntu-Light.ttf b/public/font/Ubuntu-Light.ttf deleted file mode 100644 index 0e9f90d..0000000 Binary files a/public/font/Ubuntu-Light.ttf and /dev/null differ diff --git a/public/font/Ubuntu-LightItalic.ttf b/public/font/Ubuntu-LightItalic.ttf deleted file mode 100644 index 2e007de..0000000 Binary files a/public/font/Ubuntu-LightItalic.ttf and /dev/null differ diff --git a/public/font/Ubuntu-Medium.ttf b/public/font/Ubuntu-Medium.ttf deleted file mode 100644 index 5296045..0000000 Binary files a/public/font/Ubuntu-Medium.ttf and /dev/null differ diff --git a/public/font/Ubuntu-MediumItalic.ttf b/public/font/Ubuntu-MediumItalic.ttf deleted file mode 100644 index 5dc193d..0000000 Binary files a/public/font/Ubuntu-MediumItalic.ttf and /dev/null differ diff --git a/public/font/Ubuntu-Regular.ttf b/public/font/Ubuntu-Regular.ttf deleted file mode 100644 index dbb834a..0000000 Binary files a/public/font/Ubuntu-Regular.ttf and /dev/null differ diff --git a/public/images/chora_dark.png b/public/images/chora_dark.png deleted file mode 100644 index caca714..0000000 Binary files a/public/images/chora_dark.png and /dev/null differ diff --git a/public/images/chora_dark_background.png b/public/images/chora_dark_background.png deleted file mode 100644 index aa1fa6b..0000000 Binary files a/public/images/chora_dark_background.png and /dev/null differ diff --git a/public/images/chora_dark_icon.png b/public/images/chora_dark_icon.png deleted file mode 100644 index b977249..0000000 Binary files a/public/images/chora_dark_icon.png and /dev/null differ diff --git a/public/images/chora_dark_large.png b/public/images/chora_dark_large.png deleted file mode 100644 index 3328a11..0000000 Binary files a/public/images/chora_dark_large.png and /dev/null differ diff --git a/public/images/chora_dark_small.png b/public/images/chora_dark_small.png deleted file mode 100644 index ef8eed7..0000000 Binary files a/public/images/chora_dark_small.png and /dev/null differ diff --git a/public/images/chora_light.png b/public/images/chora_light.png deleted file mode 100644 index df0aef6..0000000 Binary files a/public/images/chora_light.png and /dev/null differ diff --git a/public/images/chora_light_background.png b/public/images/chora_light_background.png deleted file mode 100644 index 20fc1cd..0000000 Binary files a/public/images/chora_light_background.png and /dev/null differ diff --git a/public/images/chora_light_icon.png b/public/images/chora_light_icon.png deleted file mode 100644 index de0d3f4..0000000 Binary files a/public/images/chora_light_icon.png and /dev/null differ diff --git a/public/images/chora_light_large.png b/public/images/chora_light_large.png deleted file mode 100644 index 04a6cd4..0000000 Binary files a/public/images/chora_light_large.png and /dev/null differ diff --git a/public/images/chora_light_small.png b/public/images/chora_light_small.png deleted file mode 100644 index 9258977..0000000 Binary files a/public/images/chora_light_small.png and /dev/null differ diff --git a/public/images/favicon.ico b/public/images/favicon.ico deleted file mode 100644 index 7fa4473..0000000 Binary files a/public/images/favicon.ico and /dev/null differ diff --git a/tailwind.config.ts b/tailwind.config.ts index 9a4e1ea..125791f 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,3 +1,3 @@ module.exports = { - content: ['./app/**/*.{js,ts,jsx,tsx}'], + content: ['./app/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], } diff --git a/tsconfig.json b/tsconfig.json index 9ef6d6a..9317f54 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,9 +20,7 @@ } ], "paths": { - "@components/*": ["components/*"], - "@contexts/*": ["contexts/*"], - "@hooks/*": ["hooks/*"] + "@components/*": ["components/*"] } }, "include": [