From 8039a2b3d5d50f143f4533a88b747031ede6f43d Mon Sep 17 00:00:00 2001 From: nick-bolas Date: Tue, 20 Aug 2024 15:41:18 +0100 Subject: [PATCH 01/12] style: make form modal responsive Co-authored-by: IlliaDerevianko --- app/companies/AddCompany.tsx | 2 +- components/EditCompany.tsx | 2 +- components/MdEditor.tsx | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/companies/AddCompany.tsx b/app/companies/AddCompany.tsx index 2b72dc02..732b3b14 100644 --- a/app/companies/AddCompany.tsx +++ b/app/companies/AddCompany.tsx @@ -43,7 +43,7 @@ const AddCompanyForm = ({ close }: { close: () => void }) => { - + {SLUG_START} setSlug(e.target.value)} /> diff --git a/components/EditCompany.tsx b/components/EditCompany.tsx index 4ecc2d4f..4237f90d 100644 --- a/components/EditCompany.tsx +++ b/components/EditCompany.tsx @@ -55,7 +55,7 @@ const EditCompanyForm = ({ close, prevCompanyProfile }: { close: () => void; pre - + {SLUG_START} setSlug(e.target.value)} /> diff --git a/components/MdEditor.tsx b/components/MdEditor.tsx index 9d9d8951..9c3d93bc 100644 --- a/components/MdEditor.tsx +++ b/components/MdEditor.tsx @@ -36,18 +36,18 @@ const MdEditor: FC = ({ markdown, editorRef, onChange }) => { plugins={[ toolbarPlugin({ toolbarContents: () => ( - <> +
{/* HACK: avoid unintented focus on the first button on hover*/} + - - - + +
), }), tablePlugin(), From 528d02e5a1c821ff85cbe7ca0833412324cb15eb Mon Sep 17 00:00:00 2001 From: nick-bolas Date: Tue, 20 Aug 2024 16:07:05 +0100 Subject: [PATCH 02/12] style: add responsiveness to datetime pickers and company management panels Co-authored-by: IlliaDerevianko --- app/companies/AddCompany.tsx | 2 +- app/companies/CompanyAdminActions.tsx | 4 ++-- app/companies/[slug]/CompanyManagement.tsx | 2 +- components/UpsertEvent.tsx | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/companies/AddCompany.tsx b/app/companies/AddCompany.tsx index 732b3b14..83995914 100644 --- a/app/companies/AddCompany.tsx +++ b/app/companies/AddCompany.tsx @@ -68,7 +68,7 @@ export const AddCompany = () => { return ( - Add Company + Company ) diff --git a/app/companies/CompanyAdminActions.tsx b/app/companies/CompanyAdminActions.tsx index ddab873f..a8b730d3 100644 --- a/app/companies/CompanyAdminActions.tsx +++ b/app/companies/CompanyAdminActions.tsx @@ -9,9 +9,9 @@ export const CompanyAdminActions = () => { return ( - + Admin Actions - + diff --git a/app/companies/[slug]/CompanyManagement.tsx b/app/companies/[slug]/CompanyManagement.tsx index 9ea759f0..87190f1e 100644 --- a/app/companies/[slug]/CompanyManagement.tsx +++ b/app/companies/[slug]/CompanyManagement.tsx @@ -16,7 +16,7 @@ export const CompanyManagement = ({ company }: { company: CompanyProfile & { com Company Management - + diff --git a/components/UpsertEvent.tsx b/components/UpsertEvent.tsx index 74f0c2b7..3cf7f82a 100644 --- a/components/UpsertEvent.tsx +++ b/components/UpsertEvent.tsx @@ -15,6 +15,7 @@ import { Pencil1Icon } from "@radix-ui/react-icons" import { Card, Grid, IconButton, Text, TextField } from "@radix-ui/themes" import dynamic from "next/dynamic" import { useState } from "react" +import { useMediaQuery } from "react-responsive" const MdEditor = dynamic(() => import("@/components/MdEditor"), { ssr: false }) @@ -28,6 +29,8 @@ const UpsertEventForm = ({ companyID?: number }) => { const [summary, setSummary] = useState(prevEvent?.richSummary ?? "") + const SMALL_SCREEN_PIXELS = 560 + const isSmallScreen = useMediaQuery({ query: `(max-width: ${SMALL_SCREEN_PIXELS}px)` }) const createEventWithArgs = async (prevState: FormPassBackState, formData: FormData) => createEvent(prevState, formData, companyID ?? -1) @@ -84,7 +87,7 @@ const UpsertEventForm = ({ - + - +