Skip to content

Commit

Permalink
feat: adds required symbol for name of folder, document and etherpad (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MalinSvenberg committed May 10, 2023
1 parent 5bc43ab commit 0d09736
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/item/form/BaseItemForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ type Props = {
updatedProperties: Partial<DiscriminatedItem<UnknownExtra>>;
onChange: (props: Partial<DiscriminatedItem>) => void;
item: Partial<ItemRecord>;
required?: boolean;
};

const BaseForm: FC<Props> = ({ onChange, item, updatedProperties }) => {
const BaseForm: FC<Props> = ({
onChange,
item,
required,
updatedProperties,
}) => {
const { t: translateBuilder } = useBuilderTranslation();

const handleNameInput = (event: ChangeEvent<{ value: string }>) => {
Expand All @@ -26,6 +32,7 @@ const BaseForm: FC<Props> = ({ onChange, item, updatedProperties }) => {
<TextField
variant="standard"
autoFocus
required={required}
id={ITEM_FORM_NAME_INPUT_ID}
label={translateBuilder(BUILDER.CREATE_NEW_ITEM_NAME_LABEL)}
value={updatedProperties?.name ?? item?.name}
Expand Down
1 change: 1 addition & 0 deletions src/components/item/form/DocumentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const DocumentForm = ({
<BaseForm
onChange={onChange}
item={item}
required
updatedProperties={updatedProperties}
/>
</Box>
Expand Down
1 change: 1 addition & 0 deletions src/components/item/form/EtherpadForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const useEtherpadForm = (): { padName: string; EtherpadForm: FC } => {
<TextField
variant="standard"
autoFocus
required
id={ITEM_FORM_ETHERPAD_NAME_INPUT_ID}
label={translateBuilder(BUILDER.CREATE_NEW_ITEM_ETHERPAD_LABEL)}
value={padName}
Expand Down
1 change: 1 addition & 0 deletions src/components/item/form/FolderForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const FolderForm = ({
<BaseItemForm
onChange={onChange}
item={item}
required
updatedProperties={updatedProperties}
/>

Expand Down

0 comments on commit 0d09736

Please sign in to comment.