1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +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 * as React from "react"
import {useContext} from "react"; import {useLookAndFeel} from "./LookAndFeel";
import {LookAndFeelContext} from "./LookAndFeel";
import {Bluelib} from "@steffo/bluelib-react"; import {Bluelib} from "@steffo/bluelib-react";
@ -10,7 +9,7 @@ interface LookAndFeelBluelibProps {
export function LookAndFeelBluelib({children}: LookAndFeelBluelibProps): JSX.Element { export function LookAndFeelBluelib({children}: LookAndFeelBluelibProps): JSX.Element {
const lookAndFeel = useContext(LookAndFeelContext) const lookAndFeel = useLookAndFeel()
return ( return (
<Bluelib theme={lookAndFeel.bluelibTheme}> <Bluelib theme={lookAndFeel.bluelibTheme}>

View file

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

View file

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

View file

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