mobile friendly create submission dialog

This commit is contained in:
andrzej 2024-09-25 19:36:46 +02:00
parent 712c8da465
commit d2936f2a6b
6 changed files with 57 additions and 14 deletions

Binary file not shown.

View File

@ -32,7 +32,7 @@ export const columns: ColumnDef<PubsWithGenres>[] = [
}, },
cell: cell => ( cell: cell => (
<> <>
<p className="block text-xs md:hidden">{cell.getValue()}</p> <p className="block text-xs max-w-24 break-words md:hidden">{cell.getValue()}</p>
<TextInputCell cellContext={cell} className="hidden md:block" /> <TextInputCell cellContext={cell} className="hidden md:block" />
</> </>
), ),
@ -49,7 +49,7 @@ export const columns: ColumnDef<PubsWithGenres>[] = [
), ),
cell: cell => ( cell: cell => (
<> <>
<p className="block text-xs md:hidden">{cell.getValue()}</p> <p className="block text-xs max-w-16 truncate md:hidden">{cell.getValue()}</p>
<TextInputCell cellContext={cell} className="hidden md:block" /> <TextInputCell cellContext={cell} className="hidden md:block" />
</> </>
), ),

View File

@ -31,7 +31,7 @@ export const columns: ColumnDef<StoryWithGenres>[] = [
}, },
cell: cell => ( cell: cell => (
<> <>
<p className="block md:hidden text-xs">{cell.getValue()}</p> <p className="block break-words max-w-36 md:hidden text-xs">{cell.getValue()}</p>
<TextInputCell cellContext={cell} className="hidden md:block" /> <TextInputCell cellContext={cell} className="hidden md:block" />
</> </>
), ),

View File

@ -34,7 +34,7 @@ export default function CreateSubmissionDialog({ stories, pubs, responses, defau
<Plus className="block md:hidden" /> <Plus className="block md:hidden" />
</Button> </Button>
</DialogTrigger> </DialogTrigger>
<DialogContent> <DialogContent className="text-xs md:text-sm">
<DialogHeader> <DialogHeader>
<DialogTitle>New submission</DialogTitle> <DialogTitle>New submission</DialogTitle>
<DialogDescription>Create an entry for a new story i.e. a thing you intend to submit for publication.</DialogDescription> <DialogDescription>Create an entry for a new story i.e. a thing you intend to submit for publication.</DialogDescription>

View File

@ -989,6 +989,22 @@ body {
max-width: 20rem; max-width: 20rem;
} }
.max-w-8 {
max-width: 2rem;
}
.max-w-24 {
max-width: 6rem;
}
.max-w-16 {
max-width: 4rem;
}
.max-w-36 {
max-width: 9rem;
}
.shrink-0 { .shrink-0 {
flex-shrink: 0; flex-shrink: 0;
} }
@ -1182,6 +1198,12 @@ body {
margin-bottom: calc(2rem * var(--tw-space-y-reverse)); margin-bottom: calc(2rem * var(--tw-space-y-reverse));
} }
.space-y-3 > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));
margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));
}
.justify-self-end { .justify-self-end {
justify-self: end; justify-self: end;
} }
@ -1194,10 +1216,20 @@ body {
overflow: hidden; overflow: hidden;
} }
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.whitespace-nowrap { .whitespace-nowrap {
white-space: nowrap; white-space: nowrap;
} }
.break-words {
overflow-wrap: break-word;
}
.rounded-3xl { .rounded-3xl {
border-radius: 1.5rem; border-radius: 1.5rem;
} }
@ -2396,6 +2428,12 @@ body {
flex-direction: column; flex-direction: column;
} }
.md\:space-y-8 > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
margin-bottom: calc(2rem * var(--tw-space-y-reverse));
}
.md\:rounded-l-3xl { .md\:rounded-l-3xl {
border-top-left-radius: 1.5rem; border-top-left-radius: 1.5rem;
border-bottom-left-radius: 1.5rem; border-bottom-left-radius: 1.5rem;
@ -2419,6 +2457,11 @@ body {
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.25rem; line-height: 1.25rem;
} }
.md\:text-base {
font-size: 1rem;
line-height: 1.5rem;
}
} }
.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]) { .\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]) {

View File

@ -95,7 +95,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
return ( return (
<Form {...form}> <Form {...form}>
<form id="subform" onSubmit={form.handleSubmit(onSubmit, onErrors)} className="space-y-8"> <form id="subform" onSubmit={form.handleSubmit(onSubmit, onErrors)} className="space-y-2 md:space-y-8 text-xs">
<FormField <FormField
control={form.control} control={form.control}
name="storyId" name="storyId"
@ -114,7 +114,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
{storiesSelectItems} {storiesSelectItems}
</SelectContent> </SelectContent>
</Select> </Select>
<FormDescription>The piece you submitted</FormDescription> <FormDescription className="text-xs md:text-base">The piece you submitted</FormDescription>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
@ -124,7 +124,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
name="pubId" name="pubId"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Publication</FormLabel> <FormLabel className="text-sm md:text-base">Publication</FormLabel>
<Select onValueChange={field.onChange} defaultValue={field.value}> <Select onValueChange={field.onChange} defaultValue={field.value}>
<FormControl> <FormControl>
<SelectTrigger> <SelectTrigger>
@ -137,7 +137,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
{pubsSelectItems} {pubsSelectItems}
</SelectContent> </SelectContent>
</Select> </Select>
<FormDescription>The market you sent it to</FormDescription> <FormDescription className="text-xs md:text-base">The market you sent it to</FormDescription>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
@ -148,7 +148,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
name="submitted" name="submitted"
render={({ field }) => ( render={({ field }) => (
<FormItem className="flex flex-col"> <FormItem className="flex flex-col">
<FormLabel>Date of submission</FormLabel> <FormLabel className="text-sm md:text-base">Date of submission</FormLabel>
<Popover modal={true} open={isSubCalendarOpen} onOpenChange={setIsSubCalendarOpen}> <Popover modal={true} open={isSubCalendarOpen} onOpenChange={setIsSubCalendarOpen}>
<PopoverTrigger asChild> <PopoverTrigger asChild>
<FormControl> <FormControl>
@ -180,7 +180,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
/> />
</PopoverContent> </PopoverContent>
</Popover> </Popover>
<FormDescription> <FormDescription className="text-xs md:text-base">
The date you sent it The date you sent it
</FormDescription> </FormDescription>
<FormMessage /> <FormMessage />
@ -193,7 +193,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
name="responded" name="responded"
render={({ field }) => ( render={({ field }) => (
<FormItem className="flex flex-col"> <FormItem className="flex flex-col">
<FormLabel>Date of response</FormLabel> <FormLabel className="text-sm md:text-base">Date of response</FormLabel>
<Popover modal={true} open={isRespCalendarOpen} onOpenChange={setIsRespCalendarOpen}> <Popover modal={true} open={isRespCalendarOpen} onOpenChange={setIsRespCalendarOpen}>
<PopoverTrigger asChild> <PopoverTrigger asChild>
<FormControl> <FormControl>
@ -225,7 +225,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
/> />
</PopoverContent> </PopoverContent>
</Popover> </Popover>
<FormDescription> <FormDescription className="text-xs md:text-base">
The date they wrote back The date they wrote back
</FormDescription> </FormDescription>
<FormMessage /> <FormMessage />
@ -239,7 +239,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
name="responseId" name="responseId"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Response</FormLabel> <FormLabel className="text-sm md:text-base">Response</FormLabel>
<Select onValueChange={field.onChange} defaultValue={field.value}> <Select onValueChange={field.onChange} defaultValue={field.value}>
<FormControl> <FormControl>
<SelectTrigger> <SelectTrigger>
@ -252,7 +252,7 @@ export default function SubmissionForm({ stories, pubs, responses, defaults, clo
{reponsesSelectItems} {reponsesSelectItems}
</SelectContent> </SelectContent>
</Select> </Select>
<FormDescription>The market you sent it to</FormDescription> <FormDescription className="text-xs md:text-base">The market you sent it to</FormDescription>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}