1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 06:44:21 +00:00

💥 Replace useContext with useLookAndFeel

This commit is contained in:
Steffo 2021-09-30 02:22:47 +02:00 committed by Stefano Pigozzi
parent edc45750d9
commit c8d7ddff54
4 changed files with 8 additions and 13 deletions

View file

@ -1,6 +1,5 @@
import * as React from "react"
import {useContext} from "react";
import {LookAndFeelContext} from "./LookAndFeel";
import {useLookAndFeel} from "./LookAndFeel";
import {Bluelib} from "@steffo/bluelib-react";
@ -10,7 +9,7 @@ interface LookAndFeelBluelibProps {
export function LookAndFeelBluelib({children}: LookAndFeelBluelibProps): JSX.Element {
const lookAndFeel = useContext(LookAndFeelContext)
const lookAndFeel = useLookAndFeel()
return (
<Bluelib theme={lookAndFeel.bluelibTheme}>

View file

@ -1,8 +1,7 @@
import * as React from "react"
import {HeadingProps} from "@steffo/bluelib-react/dist/components/common/Heading";
import {Heading} from "@steffo/bluelib-react";
import {useContext} from "react";
import {LookAndFeelContext} from "./LookAndFeel";
import {useLookAndFeel} from "./LookAndFeel";
interface LookAndFeelHeadingProps extends HeadingProps {
@ -11,7 +10,7 @@ interface LookAndFeelHeadingProps extends HeadingProps {
export function LookAndFeelHeading({...props}: LookAndFeelHeadingProps): JSX.Element {
const lookAndFeel = useContext(LookAndFeelContext)
const lookAndFeel = useLookAndFeel()
return (
<Heading {...props}>

View file

@ -1,11 +1,9 @@
import * as React from "react"
import * as ReactDOM from "react-dom"
import {useContext} from "react";
import {LookAndFeelContext} from "./LookAndFeel";
import {useLookAndFeel} from "./LookAndFeel";
export function LookAndFeelPageTitle(): null {
const lookAndFeel = useContext(LookAndFeelContext)
const lookAndFeel = useLookAndFeel()
React.useEffect(
() => {

View file

@ -1,7 +1,6 @@
import * as React from "react"
import {useContext} from "react"
import {Anchor, Footer} from "@steffo/bluelib-react";
import {LookAndFeelContext} from "./LookAndFeel";
import {useLookAndFeel} from "./LookAndFeel";
const FOOTER_COLORS = {
@ -17,7 +16,7 @@ const LICENSE_URL = "https://github.com/Steffo99/sophon/blob/main/LICENSE.txt"
export function SophonFooter(): JSX.Element {
const lookAndFeel = useContext(LookAndFeelContext)
const lookAndFeel = useLookAndFeel()
const frontendVersion = process.env.REACT_APP_VERSION
const backendVersion = lookAndFeel.backendVersion