Test post title

Jakub Bąbelek4 min read

Lorem ipsum dolor sit amet, consectetur adipiscing test url. Duis faucibus sapien risus, at eleifend libero pellentesque nec. Vivamus et accumsan urna. Donec porttitor ligula ut odio pellentesque, a facilisis elit bibendum. Mauris in interdum risus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Suspendisse non orci justo. Integer elementum, est eu tincidunt tincidunt, lacus lorem consectetur nisi, et tincidunt purus ex eget orci. Fusce eu ultrices enim.

Test headingLink to this section

Aenean pretium, ipsum ut porta tincidunt, dui lacus eleifend tortor, ut vulputate lectus est a libero. Donec dapibus urna nec justo molestie, sit amet condimentum turpis finibus. In placerat sem mattis eleifend interdum. Praesent finibus orci sit amet nunc varius aliquam. Phasellus eu eleifend dolor, id vestibulum ante. Nullam quam sapien, facilisis tempor interdum sit amet, fringilla at augue. Aliquam quam nibh, pharetra nec felis et, tristique ullamcorper sapien. Pellentesque rutrum eros sed placerat lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas et nunc id tortor rhoncus congue vitae eget lacus. Nullam vestibulum lacus a euismod aliquam. Curabitur luctus libero ut commodo ultricies.

Nullam vestibulum lacus a euismod aliquam. Curabitur luctus libero ut commodo ultricies.

.test-class {
  color: #2345ff;
}
import React, { useState, useEffect } from 'react';
import themeValues from '../../ui/theme';

const theme = {
  ...themeValues,
  bgColor: 'var(--theme-colors-bgPrimary)',
  bgSecondary: 'var(--theme-colors-bgSecondary)',
  bgWatermark: 'var(--theme-colors-bgWatermark)',
  bgAccent: 'var(--theme-colors-bgAccent)',
  textColor: 'var(--theme-colors-text)',
  primaryColor: 'var(--theme-colors-primary)',
  secondaryColor: 'var(--theme-colors-secondary)',
  gray700Color: 'var(--theme-colors-gray700)',
  gray500Color: 'var(--theme-colors-gray500)',
  gray300Color: 'var(--theme-colors-gray300)',
  hlShadow: 'var(--theme-colors-hlShadow)',
  hlComment: 'var(--theme-colors-hlComment)',
  hlPunctuation: 'var(--theme-colors-hlPunctuation)',
  hlProperty: 'var(--theme-colors-hlProperty)',
  hlBoolean: 'var(--theme-colors-hlBoolean)',
  hlSelector: 'var(--theme-colors-hlSelector)',
  hlFunction: 'var(--theme-colors-hlFunction)',
};

export const ThemeContext = React.createContext({
  theme: theme,
  themeName: null,
  setTheme: () => {},
});

const Root = ({ children }) => {
  const [themeName, setThemeName] = useState();

  useEffect(() => {
    // set initial theme based on value set on window
    setThemeName(window.__theme);

    // set up listener for custom theme change event
    window.addEventListener('themeChange', (event) => {
      setThemeName(event.detail);
    });
  }, []);

  // allow user to manually change their theme
  const setTheme = (themeName) => {
    window.__setPreferredTheme(themeName);
    //addAlert(`Theme set to ${themeName}`);
  };

  return (
    <ThemeContext.Provider value={{ theme, themeName, setTheme }}>
      {children}
    </ThemeContext.Provider>
  );
};

export default Root;

Aenean pretium, test url ut porta tincidunt, dui lacus eleifend tortor, ut vulputate lectus est a libero. Donec dapibus urna nec justo molestie, sit amet condimentum turpis finibus. In placerat sem mattis eleifend interdum. Praesent finibus orci sit amet nunc varius aliquam. Phasellus eu eleifend dolor, id vestibulum ante. Nullam quam sapien, facilisis tempor interdum sit amet, fringilla at augue. Aliquam quam nibh, pharetra nec felis et, tristique ullamcorper sapien. Pellentesque rutrum eros sed placerat lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas et nunc id tortor rhoncus congue vitae eget lacus. Nullam vestibulum lacus a euismod aliquam. Curabitur luctus libero ut commodo ultricies.

Second headingLink to this section

Aenean pretium, ipsum ut porta tincidunt, dui test url eleifend tortor, ut vulputate lectus est a libero. Donec dapibus urna nec justo molestie, sit amet condimentum turpis finibus. In placerat sem mattis eleifend interdum. Praesent finibus orci sit amet nunc varius aliquam. Phasellus eu eleifend dolor, id vestibulum ante. Nullam quam sapien, facilisis tempor interdum sit amet, fringilla at augue. Aliquam quam nibh, pharetra nec felis et, tristique ullamcorper sapien. Pellentesque rutrum eros sed placerat lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas et nunc id tortor rhoncus congue vitae eget lacus. Nullam vestibulum lacus a euismod aliquam. Curabitur luctus libero ut commodo ultricies.

Nullam vestibulum lacus a euismod aliquam. Curabitur luctus libero ut commodo ultricies.

Italian guy

Test sub heading

Donec porttitor ligula ut odio pellentesque, a facilisis elit bibendum. Mauris in interdum risus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Suspendisse non orci justo. Integer elementum, est eu tincidunt tincidunt, lacus lorem consectetur nisi, et tincidunt purus ex eget orci. Fusce eu ultrices enim.

Test subsub heading

Why did I choose this range? It’s practical for most blog and sales page designs. Plus, 100 characters per line, the optimal line length for reading speed, also happens to fall between that range depending on your font size and choice.


Written by:

Jakub Bąbelek

Student and Full Stack Developer living in Poznań, PL

© 2020, Jakub Bąbelek