/new page responsiveness

This commit is contained in:
Max Leiter 2023-07-20 20:48:02 -07:00
parent 563136fdb3
commit 0c20460c13
5 changed files with 24 additions and 10 deletions

View file

@ -1,6 +1,12 @@
{ {
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"], "extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
"ignorePatterns": ["node_modules/", "__tests__/"], "ignorePatterns": [
"node_modules/",
"__tests__/",
"coverage/",
".next/",
"public"
],
"rules": { "rules": {
"@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error" "@typescript-eslint/no-explicit-any": "error"

View file

@ -42,11 +42,9 @@ export default function DocumentTabs({
setActiveTab(newTab as "preview" | "edit") setActiveTab(newTab as "preview" | "edit")
} }
const formattingIconsVisibilityClass =
activeTab === "preview" ? "hidden" : "block"
return ( return (
<Tabs {...props} onValueChange={handleTabChange} defaultValue={defaultTab}> <Tabs {...props} onValueChange={handleTabChange} defaultValue={defaultTab}>
<TabsList className="flex justify-between"> <TabsList className="flex flex-col items-start justify-start sm:flex-row sm:items-center sm:justify-between">
<div> <div>
<TabsTrigger value="edit">{isEditing ? "Edit" : "Raw"}</TabsTrigger> <TabsTrigger value="edit">{isEditing ? "Edit" : "Raw"}</TabsTrigger>
<TabsTrigger value="preview"> <TabsTrigger value="preview">
@ -56,7 +54,9 @@ export default function DocumentTabs({
{isEditing && ( {isEditing && (
<FormattingIcons <FormattingIcons
textareaRef={codeEditorRef} textareaRef={codeEditorRef}
className={`ml-auto ${formattingIconsVisibilityClass}`} className={`ml-auto ${
activeTab === "preview" ? "hidden" : "hidden sm:block"
}`}
/> />
)} )}
</TabsList> </TabsList>
@ -68,6 +68,14 @@ export default function DocumentTabs({
flexDirection: "column" flexDirection: "column"
}} }}
> >
<FormattingIcons
textareaRef={codeEditorRef}
className={`ml-auto ${
activeTab === "preview"
? "hidden"
: "block text-muted-foreground sm:hidden"
}`}
/>
<TextareaMarkdown.Wrapper ref={codeEditorRef}> <TextareaMarkdown.Wrapper ref={codeEditorRef}>
<Textarea <Textarea
readOnly={!isEditing} readOnly={!isEditing}

View file

@ -33,7 +33,7 @@ const DatePicker = dynamic(
"text-muted-foreground" "text-muted-foreground"
)} )}
> >
<CalendarIcon className="mr-2 h-4 w-4" /> <CalendarIcon className="w-4 h-4 mr-2" />
<span>Won&apos;t expire</span> <span>Won&apos;t expire</span>
</Button> </Button>
) )
@ -255,7 +255,7 @@ function Post({
} }
return ( return (
<div className="flex flex-1 flex-col gap-4"> <div className="flex flex-col flex-1 gap-4">
<Title title={title} onChange={onChangeTitle} className="py-4" /> <Title title={title} onChange={onChangeTitle} className="py-4" />
{/* <Description description={description} onChange={onChangeDescription} /> */} {/* <Description description={description} onChange={onChangeDescription} /> */}
<EditDocumentList <EditDocumentList
@ -267,7 +267,7 @@ function Post({
/> />
<FileDropzone setDocs={uploadDocs} /> <FileDropzone setDocs={uploadDocs} />
<div className="mt-4 flex items-center justify-between"> <div className="flex flex-col items-end justify-between gap-4 mt-4 sm:flex-row sm:items-center">
<span className="flex flex-1 gap-2"> <span className="flex flex-1 gap-2">
<Button <Button
onClick={() => { onClick={() => {

View file

@ -26,7 +26,7 @@ export function DatePicker({
!expiresAt && "text-muted-foreground" !expiresAt && "text-muted-foreground"
)} )}
> >
<CalendarIcon className="mr-2 h-4 w-4" /> <CalendarIcon className="w-4 h-4 mr-2" />
{expiresAt ? ( {expiresAt ? (
format(expiresAt, "PPP") format(expiresAt, "PPP")
) : ( ) : (

View file

@ -15,7 +15,7 @@ export default function Layout({
<div className={clsx(styles.page, forSites && styles.forSites)}> <div className={clsx(styles.page, forSites && styles.forSites)}>
<div className="flex flex-col justify-between h-screen"> <div className="flex flex-col justify-between h-screen">
<div> {children}</div> <div> {children}</div>
<footer className="h-16 py-4 text-sm text-center text-gray-500"> <footer className="mx-auto h-4 max-w-[var(--main-content)] text-center text-sm text-gray-500">
<p> <p>
Drift is an open source project by{" "} Drift is an open source project by{" "}
<Link colored href="https://twitter.com/Max_Leiter"> <Link colored href="https://twitter.com/Max_Leiter">