Skip to content

Commit

Permalink
fix: fixed replacing CSS variables on the Colors page
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Sep 15, 2023
1 parent 948e51e commit efdbc73
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions www/src/pages/foundations/colors.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useState, useEffect, useContext } from 'react';
import { graphql } from 'gatsby';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand Down Expand Up @@ -121,7 +121,16 @@ export interface IColorsPage {
// eslint-disable-next-line react/prop-types
export default function ColorsPage({ data }: IColorsPage) {
const { settings } = useContext(SettingsContext);
const styles = typeof window !== 'undefined' ? getComputedStyle(document.body) : null;
const [styles, setStyles] = useState<CSSStyleDeclarationType>(null);

useEffect(() => {
setTimeout(() => {
if (typeof window !== 'undefined') {
const newStyles = getComputedStyle(document.body);
setStyles(newStyles);
}
}, 500);
}, [settings.theme]);

parseColors(data.allCssUtilityClasses.nodes); // eslint-disable-line react/prop-types

Expand Down

0 comments on commit efdbc73

Please sign in to comment.