From 2fb8610e64f51f4180b96f96b2c63eec24f87dcb Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 4 Feb 2022 06:16:29 +0100 Subject: [PATCH] Finish fr --- components/theme-switcher.tsx | 20 +++++++++++++ pages/_app.tsx | 53 +++++++++++++++++++-------------- pages/index.tsx | 37 +++++++++++++++++++++++ pages/year3/paradigmi/index.tsx | 2 ++ 4 files changed, 89 insertions(+), 23 deletions(-) create mode 100644 components/theme-switcher.tsx diff --git a/components/theme-switcher.tsx b/components/theme-switcher.tsx new file mode 100644 index 0000000..76e7d01 --- /dev/null +++ b/components/theme-switcher.tsx @@ -0,0 +1,20 @@ +import { Form } from "@steffo/bluelib-react"; +import { createContext, useContext } from "react"; + +export const Theme: any = createContext(["sophon", () => console.error("Setting theme outside of context")]) + +export const ThemeSwitcher = () => { + const [theme, setTheme] = useContext(Theme) + + return ( +
+ + + ) +} \ No newline at end of file diff --git a/pages/_app.tsx b/pages/_app.tsx index b22175b..fd0aebf 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -2,32 +2,39 @@ import "../styles/global.css" import type { AppProps } from 'next/app' import { Link } from "../components/link" import {Bluelib, Heading, LayoutThreeCol, Anchor as A, Footer} from "@steffo/bluelib-react" +import { useState } from "react" +import { BluelibTheme } from "@steffo/bluelib-react/dist/types" +import { Theme } from "../components/theme-switcher" function MyApp({ Component, pageProps }: AppProps) { + const [theme, setTheme] = useState("sophon") + return ( - - - - - - Unisteffo - - - - - - - + + + + + + + Unisteffo + + + + + + + + ) } diff --git a/pages/index.tsx b/pages/index.tsx index 481da97..5eb1112 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,6 +1,7 @@ import { Heading, Chapter, Box, Idiomatic as I, Anchor as A, ListUnordered, ListOrdered } from '@steffo/bluelib-react' import type { NextPage } from 'next' import { Link } from "../components/link" +import { ThemeSwitcher } from '../components/theme-switcher' const Home: NextPage = () => { @@ -155,6 +156,42 @@ const Home: NextPage = () => { + + + + Amici e colleghi + + + + + Erre2 (Modena) + + + + + Erre2 Next (Bologna) + + + + + [unimore-informatica] su GitHub + + + + + Unimore Informatica Telegram + + + + + + + + Cambia tema + + + + } diff --git a/pages/year3/paradigmi/index.tsx b/pages/year3/paradigmi/index.tsx index 3c36358..cd330dc 100644 --- a/pages/year3/paradigmi/index.tsx +++ b/pages/year3/paradigmi/index.tsx @@ -39,6 +39,8 @@ const Page: NextPage = () => { Tris in Prolog + + Lunghezza di una lista in Prolog