Compare commits
8 commits
479f52af33
...
5ac558462a
Author | SHA1 | Date | |
---|---|---|---|
5ac558462a | |||
61e52a0956 | |||
5398a39673 | |||
95681eabce | |||
8ab199b8be | |||
fa0b116300 | |||
1a4a506edb | |||
3e0a362557 |
16 changed files with 95 additions and 23 deletions
.gitignorepackage.json
src
tsconfig.json
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -12,4 +12,5 @@ yarn-error.log*
|
|||
|
||||
pnpm-lock.yaml
|
||||
|
||||
dist
|
||||
dist
|
||||
build
|
|
@ -7,7 +7,12 @@
|
|||
"typescript": "^5.5.3"
|
||||
},
|
||||
"scripts": {
|
||||
"showcase": "pnpm --filter showcase run"
|
||||
"showcase": "pnpm --filter showcase run",
|
||||
"core": "pnpm --filter core run"
|
||||
},
|
||||
"private": true
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/core",
|
||||
"src/core"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3,9 +3,21 @@
|
|||
"version": "0.0.0",
|
||||
"description": "Thunder Network's Dynamic Design",
|
||||
"license": "MIT",
|
||||
"author": "Thunder Network RaD | KillerBossOriginal",
|
||||
"author": {
|
||||
"name": "Thunder Network Research and Development",
|
||||
"email": "thundernetwork.org@gmail.com",
|
||||
"url": "https://thundernetwork.org"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "KillerBossOriginal",
|
||||
"email": "KillerBossOriginal@outlook.it",
|
||||
"url": "https://source.thundernetwork.org/KillerBossOriginal"
|
||||
}
|
||||
],
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "tsc && sass styles build"
|
||||
"build": "tsc && sass src/styles:build"
|
||||
},
|
||||
"keywords": [
|
||||
"components",
|
||||
|
|
|
@ -1,26 +1,18 @@
|
|||
"use client";
|
||||
import {CursorProvider, CursorProviderProps} from "./Cursor";
|
||||
import {ThemeProvider} from "./Theme";
|
||||
import Theme from "../types/theme";
|
||||
import {defaultTheme} from "../index";
|
||||
import {NavigationProvider, NavigationProviderProps} from "./Navigation";
|
||||
import { ThemeProvider } from "@core/components/Theme";
|
||||
import Theme from "@core/types/theme";
|
||||
import { defaultTheme } from "@core/index";
|
||||
|
||||
interface DynamicProviderProps {
|
||||
cursor?: CursorProviderProps,
|
||||
theme?: Theme,
|
||||
children: React.ReactNode,
|
||||
selector?: NavigationProviderProps
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export function DynamicProvider({ children, cursor, theme, selector }: DynamicProviderProps) {
|
||||
export function DynamicProvider({ children, theme }: DynamicProviderProps) {
|
||||
const actualTheme = theme || defaultTheme
|
||||
return (
|
||||
<ThemeProvider defaultTheme={actualTheme}>
|
||||
<CursorProvider hidden={cursor?.hidden || true} exists={cursor?.exists || false} cursor={cursor?.cursor}>
|
||||
<NavigationProvider defaultCoords={selector?.defaultCoords}>
|
||||
{children}
|
||||
</NavigationProvider>
|
||||
</CursorProvider>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
import Theme from "@core/types/theme";
|
||||
import { DynamicProvider } from "./components/DynamicProvider";
|
||||
|
||||
export const defaultTheme: Theme = {
|
||||
colorScheme: "light"
|
||||
}
|
||||
|
||||
export {
|
||||
DynamicProvider
|
||||
}
|
17
src/core/src/styles/components/_fonts.scss
Normal file
17
src/core/src/styles/components/_fonts.scss
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Geist
|
||||
@font-face {
|
||||
font-style: normal;
|
||||
font-weight: 100 900;
|
||||
src: url("fonts/geist.woff2") format("woff2");
|
||||
font-family: "Geist";
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
// Geist Mono
|
||||
@font-face {
|
||||
font-style: normal;
|
||||
font-weight: 100 900;
|
||||
src: url("fonts/geist-mono.woff2") format("woff2");
|
||||
font-family: "Geist Mono";
|
||||
font-display: swap;
|
||||
}
|
4
src/core/src/styles/components/_functions.scss
Normal file
4
src/core/src/styles/components/_functions.scss
Normal file
|
@ -0,0 +1,4 @@
|
|||
// Converts px values to rem
|
||||
@function rpx($px-value) {
|
||||
@return ($px-value / 16) + rem;
|
||||
}
|
27
src/core/src/styles/components/_variables.scss
Normal file
27
src/core/src/styles/components/_variables.scss
Normal file
|
@ -0,0 +1,27 @@
|
|||
@use "functions" as *;
|
||||
|
||||
@mixin theme-variables {
|
||||
:root {
|
||||
@content ("light");
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
@content ("dark");
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) {
|
||||
@content ("dark");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include theme-variables using ($theme) {
|
||||
@if $theme == "dark" {
|
||||
--color: #fff;
|
||||
}
|
||||
|
||||
else {
|
||||
--color: #000;
|
||||
}
|
||||
}
|
4
src/core/src/styles/style.scss
Normal file
4
src/core/src/styles/style.scss
Normal file
|
@ -0,0 +1,4 @@
|
|||
@use "components/variables";
|
||||
@use "components/fonts";
|
||||
|
||||
@use "components/typography";
|
|
@ -26,4 +26,4 @@ export function NavigationProvider({ children, defaultCoords }: NavigationProvid
|
|||
|
||||
export function useNavigation() {
|
||||
return useContext(NavigationContext);
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: 256px | Height: 256px | Size: 25 KiB After Width: 256px | Height: 256px | Size: 21 KiB |
|
@ -1,6 +1,7 @@
|
|||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import { DynamicProvider } from "@dynamic/core";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
|
@ -25,7 +26,9 @@ export default function RootLayout({
|
|||
return (
|
||||
<html lang="en">
|
||||
<body className={`${geistSans.variable} ${geistMono.variable}`}>
|
||||
{children}
|
||||
<DynamicProvider>
|
||||
{children}
|
||||
</DynamicProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
|
@ -19,7 +20,8 @@
|
|||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
"@/*": ["./*"],
|
||||
"@dynamic/core": ["../core/src/index"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "dist",
|
||||
"outDir": "build",
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
|
|
Loading…
Add table
Reference in a new issue