From 11be57148f1f8a13208a099879988d65caa057b7 Mon Sep 17 00:00:00 2001 From: hejsaga Date: Thu, 14 Sep 2023 17:18:07 +0200 Subject: [PATCH] fix: modal and layout for big screens (#306) --- .../src/components/Inputs/Select.tsx | 15 +++------ frontend-typescript/src/components/Modal.tsx | 22 +++++++++++++ frontend-typescript/src/components/Rules.tsx | 13 ++++---- .../src/components/SideMenu/SideMenu.tsx | 2 +- frontend-typescript/src/components/Teams.tsx | 33 +++++++++++-------- frontend-typescript/src/index.css | 6 ++-- frontend-typescript/tailwind.config.cjs | 8 ++++- 7 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 frontend-typescript/src/components/Modal.tsx diff --git a/frontend-typescript/src/components/Inputs/Select.tsx b/frontend-typescript/src/components/Inputs/Select.tsx index bded28f2..490d124f 100644 --- a/frontend-typescript/src/components/Inputs/Select.tsx +++ b/frontend-typescript/src/components/Inputs/Select.tsx @@ -1,25 +1,20 @@ -import { FC, memo, useCallback, useState } from 'react'; +import { FC, memo } from 'react'; type SelectProps = { label: string; value: number | string; - options: {label:string, value: string}[]; + options: { label: string; value: string }[]; onChange: (event: React.ChangeEvent) => void; }; -export const Select: FC = memo(props => { +export const Select: FC = memo((props) => { const { label, value, options, onChange } = props; - //const [selectedValue, setSelectedValue] = useState(value); - - // const handleOnChange = useCallback(() => { - // onChange(); - // }, [onChange]); return (
); -}); +}); Select.displayName = 'Select'; diff --git a/frontend-typescript/src/components/Modal.tsx b/frontend-typescript/src/components/Modal.tsx new file mode 100644 index 00000000..ba795ef3 --- /dev/null +++ b/frontend-typescript/src/components/Modal.tsx @@ -0,0 +1,22 @@ +export const Modal = ({ children }: React.PropsWithChildren) => { + return ( +
+
+ +
+
+
+
+
{children}
+
+
+
+
+
+ ); +}; diff --git a/frontend-typescript/src/components/Rules.tsx b/frontend-typescript/src/components/Rules.tsx index cfc50e53..3d800ba8 100644 --- a/frontend-typescript/src/components/Rules.tsx +++ b/frontend-typescript/src/components/Rules.tsx @@ -1,5 +1,6 @@ import { FC, memo } from 'react'; import { IRules, useBoardConfig } from '../hooks/useBoardConfig'; +import { Modal } from './Modal'; type RulesProps = { onClose: () => void; @@ -9,16 +10,14 @@ type RulesProps = { export const Rules: FC = memo((props) => { const { visible, seasonId, onClose } = props; - const rules = true; - const seasonRules: IRules = useBoardConfig(seasonId); return visible ? ( -
-
-

Season rules

+ +
+

Season rules

- {rules ? ( + {seasonRules ? ( <>

{seasonRules.gridSize}

@@ -47,7 +46,7 @@ export const Rules: FC = memo((props) => { -
+
) : ( <> ); diff --git a/frontend-typescript/src/components/SideMenu/SideMenu.tsx b/frontend-typescript/src/components/SideMenu/SideMenu.tsx index 7ed19cf3..9a269343 100644 --- a/frontend-typescript/src/components/SideMenu/SideMenu.tsx +++ b/frontend-typescript/src/components/SideMenu/SideMenu.tsx @@ -52,7 +52,7 @@ export const SideMenu: FC = memo((props) => {
diff --git a/frontend-typescript/src/components/Teams.tsx b/frontend-typescript/src/components/Teams.tsx index c9764587..a10d73c3 100644 --- a/frontend-typescript/src/components/Teams.tsx +++ b/frontend-typescript/src/components/Teams.tsx @@ -1,4 +1,6 @@ +import useFetch from '../hooks/useFetch'; import { useFetchRepeatedly } from '../hooks/useFetchRepeatedly'; +import { HighScoreTable } from './HighScoreTable'; import { Table } from './Table'; const url: string = 'api/teams'; @@ -6,20 +8,25 @@ const delay: number = 60000; // 1 min export const Teams = () => { const teams = useFetchRepeatedly(url, delay, []) as ITeam[]; + const { response: currentSeason } = useFetch('api/seasons/current', '0'); + return ( -
-
- { - return { - name: team.name, - abbreviation: team.abbreviation, - icon: school-logo, - }; - })} - /> +
+
+
+
{ + return { + name: team.name, + abbreviation: team.abbreviation, + icon: school-logo, + }; + })} + /> + + ); diff --git a/frontend-typescript/src/index.css b/frontend-typescript/src/index.css index d23f0a59..af5b49ce 100644 --- a/frontend-typescript/src/index.css +++ b/frontend-typescript/src/index.css @@ -17,12 +17,12 @@ .text-label { @apply font-sans not-italic font-bold mb-1; - @apply text-sm text-etimo dark:text-slate-400 block; + @apply text-sm 4xl:text-xl text-etimo dark:text-slate-400 block; } .text-body { @apply font-sans not-italic mb-1; - @apply text-sm text-etimo dark:text-slate-400 block; + @apply text-sm 4xl:text-lg text-etimo dark:text-slate-400 block; } a, @@ -53,7 +53,7 @@ } .modal-button { - @apply absolute top-[6px] right-[12px]; + @apply absolute text-2xl top-[6px] right-[12px]; } } diff --git a/frontend-typescript/tailwind.config.cjs b/frontend-typescript/tailwind.config.cjs index 06ac407a..cb1e553b 100644 --- a/frontend-typescript/tailwind.config.cjs +++ b/frontend-typescript/tailwind.config.cjs @@ -12,7 +12,13 @@ module.exports = { }, }, fontFamily: { sans: ['Quattrocento Sans', ...defaultSans] }, - extend: { colors: { etimo: '#2c3e50', 'etimo-light': '#375b7d' } }, + extend: { + colors: { etimo: '#2c3e50', 'etimo-light': '#375b7d' }, + screens: { + '3xl': '1700px', + '4xl': '2300px', + }, + }, }, plugins: [], };