diff --git a/dev/devPage.tsx b/dev/devPage.tsx index 38c01b5e..6ace224c 100644 --- a/dev/devPage.tsx +++ b/dev/devPage.tsx @@ -10,10 +10,25 @@ const HeaderComponent: React.FC = () => { const activeColor = 'navy 0-100' const inActiveColor = 'navy o-50' const [exploreFormType, setExploreFormType] = useState('cid') + const [isDarkTheme, setIsDarkTheme] = useState(false) const [cidColor, setCidColor] = useState(activeColor) const [carColor, setCarColor] = useState(inActiveColor) const { t } = useTranslation('explore') + function toggleTheme (): void { + setIsDarkTheme(prev => { + const newTheme = !prev + document.documentElement.setAttribute('data-theme', newTheme ? 'dark' : 'light') + return newTheme + }) + } + + // apply theme on component mount + useEffect(() => { + document.documentElement.setAttribute('data-theme', isDarkTheme ? 'dark' : 'light') + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + function handleOnChange (evt: MouseEvent): void { const selectedType = evt.currentTarget.getAttribute('data-value') if (selectedType == null) { @@ -32,7 +47,7 @@ const HeaderComponent: React.FC = () => { } return ( -
+
{/* IPFS */} @@ -54,6 +69,12 @@ const HeaderComponent: React.FC = () => { +
) diff --git a/src/components/ExplorePage.tsx b/src/components/ExplorePage.tsx index 9985f873..fe24afa7 100644 --- a/src/components/ExplorePage.tsx +++ b/src/components/ExplorePage.tsx @@ -13,6 +13,7 @@ import IpldGraph from './graph/IpldGraphCytoscape.js' import GraphCrumb from './graph-crumb/GraphCrumb.js' import ComponentLoader from './loader/component-loader.js' import { ObjectInfo } from './object-info/ObjectInfo.js' +import '../index.css' export const ExplorePage = ({ runTour = false, @@ -70,7 +71,7 @@ export const ExplorePage = ({ ? ( ) diff --git a/src/components/StartExploringPage.tsx b/src/components/StartExploringPage.tsx index 2083d586..1aa04d76 100644 --- a/src/components/StartExploringPage.tsx +++ b/src/components/StartExploringPage.tsx @@ -15,7 +15,7 @@ const ExploreSuggestion = ({ cid, name, type }: { cid: string, name: string, typ

{name}

- {cid} + {cid}
) @@ -31,14 +31,14 @@ export const StartExploringPage: React.FC = ({ embed, r const { t } = useTranslation('explore') return ( -
+
{t('StartExploringPage.title')}
-

{t('StartExploringPage.header')}

+

{t('StartExploringPage.header')}

{t('StartExploringPage.leadParagraph')}

{embed != null ? : null} diff --git a/src/components/about/AboutIpld.tsx b/src/components/about/AboutIpld.tsx index 0207695f..b5844e6a 100644 --- a/src/components/about/AboutIpld.tsx +++ b/src/components/about/AboutIpld.tsx @@ -2,12 +2,13 @@ import React from 'react' import { Trans, useTranslation } from 'react-i18next' import Box from '../box/Box.js' import ipldLogoSrc from './ipld.svg' +import '../../index.css' export const AboutIpld: React.FC = () => { const { t } = useTranslation('explore') return ( - +
IPLD diff --git a/src/components/box/Box.tsx b/src/components/box/Box.tsx index b71e2ba9..bd131361 100644 --- a/src/components/box/Box.tsx +++ b/src/components/box/Box.tsx @@ -12,7 +12,7 @@ export const Box: React.FC> = ({ children }) => { return ( -
+
{children} diff --git a/src/components/cid-info/CidInfo.tsx b/src/components/cid-info/CidInfo.tsx index 0d906736..5a9b96c2 100644 --- a/src/components/cid-info/CidInfo.tsx +++ b/src/components/cid-info/CidInfo.tsx @@ -39,13 +39,13 @@ export const CidInfo: React.FC = ({ cid, className, ...props }) => ? null : (
-
+
{cid.toString()}
{cidInfo.humanReadable}
-
= ({ cid, className, ...props }) => {t('multihash')}
-
+
0x {cidInfo.hashFnCode} {cidInfo.hashLengthCode} @@ -64,7 +64,7 @@ export const CidInfo: React.FC = ({ cid, className, ...props }) => {chunk.join('')}
))} -