From 431bde851ce57267cbe9a85ecd2cc5d7b4584cf6 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Tue, 27 Dec 2022 03:20:37 -0300 Subject: [PATCH] Add Select component The Select component renders a list, and provides more flexibility in how the element is styled (compared to a regular " + + ); } diff --git a/src/js/components/TheQuran/ThemeSelect.tsx b/src/js/components/TheQuran/ThemeSelect.tsx index 5eabff4..2e864b5 100644 --- a/src/js/components/TheQuran/ThemeSelect.tsx +++ b/src/js/components/TheQuran/ThemeSelect.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { Select, SelectOption } from "components/Select"; import { set as setCookie } from 'es-cookie'; interface Props { @@ -7,18 +8,15 @@ interface Props { } export function ThemeSelect ({ setTheme, theme }: Props) { - const onThemeChange = (e: React.ChangeEvent) => { - setCookie('theme', e.target.value, { domain: location.host, expires: 365 }); - setTheme(e.target.value); + const onThemeChange = (o: SelectOption) => { + setCookie('theme', o.value, { domain: location.host, expires: 365 }); + setTheme(o.value); }; return ( - - + ); } diff --git a/src/js/pages/TheSurahPage.tsx b/src/js/pages/TheSurahPage.tsx index 8c3b787..51cb6f9 100644 --- a/src/js/pages/TheSurahPage.tsx +++ b/src/js/pages/TheSurahPage.tsx @@ -39,7 +39,7 @@ function TheSurahPage({ locale, surahId }: PageProps) { {readyToRender && (
- +
)} {readyToRender && }