diff --git a/site/gatsby-browser.js b/site/gatsby-browser.js index 8b843acc..bfad2025 100644 --- a/site/gatsby-browser.js +++ b/site/gatsby-browser.js @@ -1 +1,7 @@ +import React from 'react' import "./src/styles/global.css" +import { ThemeProvider } from "./src/components/Theme" + +export const wrapRootElement = ({ element }) => ( + {element} +) \ No newline at end of file diff --git a/site/gatsby-config.js b/site/gatsby-config.js index 0e2b4e44..8a037186 100644 --- a/site/gatsby-config.js +++ b/site/gatsby-config.js @@ -6,5 +6,5 @@ module.exports = { title: `Sistent Design System | Layer5`, siteUrl: `https://design.layer5.io` }, - plugins: ["gatsby-plugin-postcss", 'gatsby-plugin-dark-mode'] + plugins: ["gatsby-plugin-postcss"] }; \ No newline at end of file diff --git a/site/package-lock.json b/site/package-lock.json index 290e3d45..8e1e35b8 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "autoprefixer": "^10.4.16", "gatsby": "^5.12.4", - "gatsby-plugin-dark-mode": "^1.1.2", "gatsby-plugin-postcss": "^6.12.0", "postcss": "^8.4.31", "react": "^18.2.0", @@ -8679,17 +8678,6 @@ "@parcel/core": "^2.0.0" } }, - "node_modules/gatsby-plugin-dark-mode": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/gatsby-plugin-dark-mode/-/gatsby-plugin-dark-mode-1.1.2.tgz", - "integrity": "sha512-kq/7/KSIgyYxolSqLxXfmcC/iBU98XpRGcIOaa3bjjl8Tb0WDYwfa45zABx1XNjB0YecWdgniss+kqmeAu04GA==", - "dependencies": { - "prop-types": "^15.5.7" - }, - "peerDependencies": { - "react": "16.x" - } - }, "node_modules/gatsby-plugin-page-creator": { "version": "5.12.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-5.12.0.tgz", @@ -22421,14 +22409,6 @@ "@parcel/transformer-json": "2.8.3" } }, - "gatsby-plugin-dark-mode": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/gatsby-plugin-dark-mode/-/gatsby-plugin-dark-mode-1.1.2.tgz", - "integrity": "sha512-kq/7/KSIgyYxolSqLxXfmcC/iBU98XpRGcIOaa3bjjl8Tb0WDYwfa45zABx1XNjB0YecWdgniss+kqmeAu04GA==", - "requires": { - "prop-types": "^15.5.7" - } - }, "gatsby-plugin-page-creator": { "version": "5.12.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-5.12.0.tgz", diff --git a/site/package.json b/site/package.json index ee77c0d5..79a4cad7 100644 --- a/site/package.json +++ b/site/package.json @@ -17,7 +17,6 @@ "dependencies": { "autoprefixer": "^10.4.16", "gatsby": "^5.12.4", - "gatsby-plugin-dark-mode": "^1.1.2", "gatsby-plugin-postcss": "^6.12.0", "postcss": "^8.4.31", "react": "^18.2.0", diff --git a/site/src/assets/images/ChevronDark.svg b/site/src/assets/images/ChevronDark.svg new file mode 100644 index 00000000..8bb54b75 --- /dev/null +++ b/site/src/assets/images/ChevronDark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/site/src/assets/images/ChevronDark.svg:Zone.Identifier b/site/src/assets/images/ChevronDark.svg:Zone.Identifier new file mode 100644 index 00000000..e69de29b diff --git a/site/src/assets/images/Weather.svg b/site/src/assets/images/Weather.svg index c1878a71..842300f1 100644 --- a/site/src/assets/images/Weather.svg +++ b/site/src/assets/images/Weather.svg @@ -1,5 +1,3 @@ - - - - + + diff --git a/site/src/assets/images/WeatherDark.svg b/site/src/assets/images/WeatherDark.svg new file mode 100644 index 00000000..d1eb4d51 --- /dev/null +++ b/site/src/assets/images/WeatherDark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/site/src/components/Navigation/index.js b/site/src/components/Navigation/index.js index 7ba47851..87352145 100644 --- a/site/src/components/Navigation/index.js +++ b/site/src/components/Navigation/index.js @@ -1,11 +1,15 @@ -import React from "react"; +import React, {useContext} from "react"; import Search from '../../assets/images/Search.svg'; import SearchDark from "../../assets/images/SearchDark.svg"; -import ThemeToggle from "../Theme"; +import ThemeContext from "../Theme"; +import Weather from '../../assets/images/Weather.svg'; +import WeatherDark from '../../assets/images/WeatherDark.svg'; -const Navbar = ()=>{ - return ( - <> +const Navbar = () => { + const theme = useContext(ThemeContext) + + return ( + <>
@@ -24,16 +28,16 @@ const Navbar = ()=>{
-
+
-
+

- ) + ) }; export default Navbar; \ No newline at end of file diff --git a/site/src/components/Sidebar/index.js b/site/src/components/Sidebar/index.js index 5d3b5d03..33e326b1 100644 --- a/site/src/components/Sidebar/index.js +++ b/site/src/components/Sidebar/index.js @@ -33,141 +33,141 @@ const Sidebar = () => {
{ drop1?
-
-
About Sistent
+
+
About Sistent
/
-
-
Introduction
+
+
Introduction
-
-
Principles
+
+
Principles
-
-
Contribution
+
+
Contribution
-
-
Support
+
+
Support
-
-
Case Studies
+
+
Case Studies
: -
-
About Sistent
+
+
About Sistent
/
}
-
+
{ drop2?
-
-
Identity
+
+
Identity
/
-
- Color +
+ Color
-
- Typography +
+ Typography
-
- Spacing +
+ Spacing
-
- Page Layouts +
+ Page Layouts
-
- Elevation +
+ Elevation
: -
-
Identity
+
+
Identity
/
}
{drop3?
-
-
Components
+
+
Components
/
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
: -
-
Components
+
+
Components
/
}
{drop4?
-
-
Patterns & Templates
+
+
Patterns & Templates
/
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
: -
-
Patterns & Templates
+
+
Patterns & Templates
/
}
{drop5?
-
-
Visualization & Illustration
+
+
Visualization & Illustration
/
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
-
-
Option 1
+
+
Option 1
: -
-
Visualization & Illustration
+
+
Visualization & Illustration
/
}
diff --git a/site/src/components/Theme/index.js b/site/src/components/Theme/index.js index 51800fe0..15e2d505 100644 --- a/site/src/components/Theme/index.js +++ b/site/src/components/Theme/index.js @@ -1,33 +1,45 @@ -import React from "react" -import { ThemeToggler } from "gatsby-plugin-dark-mode" -import Weather from '../../assets/images/Weather.svg'; -import Search from '../../assets/images/Search.svg'; -// import SearchDark from "../../assets/images/Search-dark.svg"; - -export default function ThemeToggle() { - return ( - - {({ theme, toggleTheme }) => ( - Toggle Theme toggleTheme(theme === 'dark' ? 'light' : 'dark')} - /> - - )} - - ) +import React, { useState, useEffect } from "react"; + +const defaultState = { + dark: false, + toggleDark: () => {}, +}; + +const ThemeContext = React.createContext(defaultState); + +const supportsDarkMode = () => + window.matchMedia("(prefers-color-scheme: dark)").matches === true; + +function ThemeProvider({ children }) { + const [dark, setDark] = useState(false); + + const toggleDark = () => { + const newDark = !dark; + localStorage.setItem("dark", JSON.stringify(newDark)); + setDark(newDark); + }; + + useEffect(() => { + // Getting dark mode value from localStorage! + const isDark = JSON.parse(localStorage.getItem("dark")); + if (isDark) { + setDark(isDark); + } else if (supportsDarkMode()) { + setDark(true); + } + }, []); + + return ( + + {children} + + ); } -// export function SearchToggle(){ -// return ( -// -// {({ theme}) => ( -// Toggle Search -// )} -// -// ) -// } \ No newline at end of file +export default ThemeContext; +export { ThemeProvider }; diff --git a/site/src/pages/index.js b/site/src/pages/index.js index 62940715..3e096f34 100644 --- a/site/src/pages/index.js +++ b/site/src/pages/index.js @@ -1,50 +1,52 @@ -import * as React from "react" +import React, {useContext} from "react"; import { BrowserRouter as Router, Route, Routes, Navigate, } from "react-router-dom"; -import Navbar from "../components/Navigation" -import Sidebar from "../components/Sidebar" -import Footer from "../components/Footer" +import Navbar from "../components/Navigation"; +import Sidebar from "../components/Sidebar"; +import Footer from "../components/Footer"; import Home from "./home"; import Color from "./identity/colors"; import Typography from "./identity/typography"; import Elevation from "./identity/elevation"; import Spacing from "./identity/spacing"; import PageLayout from "./identity/page-layouts"; -import ThemeToggle from "../components/Theme"; import '../styles/global.css'; +import ThemeContext from "../components/Theme"; const IndexPage = () => { -const routes = ( - - } exact/> - } exact/> - } exact/> - } exact/> - } exact/> - } exact/> - } exact/> - } exact/> - } /> - -) + const theme = useContext(ThemeContext); + const routes = ( + + } exact /> + } exact /> + } exact /> + } exact /> + } exact /> + } exact /> + } exact /> + } exact /> + } /> + + ); + return ( -
- - -
- -
{routes}
-
-
- -
- ) +
+ + +
+ +
{routes}
+
+
+ +
+ ); } -export default IndexPage +export default IndexPage; -export const Head = () => Layer5 Design System +export const Head = () => Layer5 Design System; diff --git a/site/src/styles/global.css b/site/src/styles/global.css index 771f6a79..e447e09e 100644 --- a/site/src/styles/global.css +++ b/site/src/styles/global.css @@ -6,14 +6,17 @@ @tailwind utilities; /* Global.css */ -:root { +.light { --border-strong: #647176; --border-default: #EAEDEE; --background-default: #FDFDFD; - --text-brand: #007763; - --background-brand-default: #007763; + --text-brand: #51636B; + --background-brand-default: #51636B; --text-default: #000D12; --search-default: #15272F; + --text-secondary: #3C494E; + --border-brand: #007763; + --background-brand-tertiary: #DAF2EB; } /* Define dark mode styles */ @@ -25,11 +28,11 @@ --background-brand-default: #00B39F; --text-default: #FDFDFD; --search-default: #E7EFF3; + --text-secondary: #EAEDEE; + --border-brand: #8D9FA7; + --background-brand-tertiary: #00403F; } -body { - background-color: var(--background-default); -} @font-face { font-family: "Qanelas Soft Black"; src: url('../assets/fonts/qanelas-soft/QanelasSoftBlack.otf') format('opentype'); diff --git a/site/tailwind.config.js b/site/tailwind.config.js index 5c345881..56bd19b5 100644 --- a/site/tailwind.config.js +++ b/site/tailwind.config.js @@ -14,7 +14,10 @@ module.exports = { 'text-brand': 'var(--text-brand)', 'background-brand-default': 'var(--background-brand-default)', 'text-default': 'var(--text-default)', - 'search-default': 'var(--search-default)' + 'search-default': 'var(--search-default)', + 'text-secondary': 'var(--text-secondary)', + 'border-brand': 'var(--border-brand)', + 'background-brand-tertiary': 'var(--background-brand-tertiary)', }, }, fontFamily: {