Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-1047] chore: create page modal improvement (#4266)

Anmol Singh Bhatiaa4e5138d1c39
diff --git a/web/components/pages/modals/page-form.tsx b/web/components/pages/modals/page-form.tsx
index 0698b7e2b5..2a3ad8380b 100644
--- a/web/components/pages/modals/page-form.tsx
+++ b/web/components/pages/modals/page-form.tsx
@@ -35,18 +35,14 @@ export const PageForm: React.FC<Props> = (props) => {
}
};
+ const isTitleLengthMoreThan255Character = formData.name ? formData.name.length > 255 : false;
+
return (
<form onSubmit={handlePageFormSubmit}>
<div className="space-y-4">
<h3 className="text-lg font-medium leading-6 text-custom-text-100">Create Page</h3>
<div className="space-y-2">
- <div>
- <div className="text-custom-text-200">Name</div>
- <div className="text-xs text-custom-text-300">
- Max length of the name should be less than 255 characters
- </div>
- </div>
<Input
id="name"
type="text"
@@ -56,8 +52,10 @@ export const PageForm: React.FC<Props> = (props) => {
className="w-full resize-none text-lg"
tabIndex={1}
required
- maxLength={255}
/>
+ {isTitleLengthMoreThan255Character && (
+ <span className="text-xs text-red-500">Max length of the name should be less than 255 characters</span>
+ )}
</div>
</div>
@@ -95,7 +93,14 @@ export const PageForm: React.FC<Props> = (props) => {
<Button variant="neutral-primary" size="sm" onClick={handleModalClose} tabIndex={4}>
Cancel
</Button>
- <Button variant="primary" size="sm" type="submit" loading={isSubmitting} tabIndex={5}>
+ <Button
+ variant="primary"
+ size="sm"
+ type="submit"
+ loading={isSubmitting}
+ disabled={isTitleLengthMoreThan255Character}
+ tabIndex={5}
+ >
{isSubmitting ? "Creating" : "Create Page"}
</Button>
</div>