Skip to content

Commit

Permalink
feat: limit the Molecule label length to a maximum of 10 characters
Browse files Browse the repository at this point in the history
close: #1691
  • Loading branch information
hamed-musallam committed Sep 27, 2022
1 parent 92ef49b commit 9a49474
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/component/elements/EditableColumn.tsx
Expand Up @@ -7,9 +7,10 @@ import {
useState,
} from 'react';

import Input, { InputKeyboardEvent } from './Input';
import Input, { InputKeyboardEvent, InputProps } from './Input';

interface EditableColumnProps {
interface EditableColumnProps
extends Omit<InputProps, 'style' | 'value' | 'type'> {
onSave?: (element: any) => void;
onEditStart?: (element: any) => void;
type?: 'number' | 'text';
Expand All @@ -31,6 +32,7 @@ const EditableColumn = forwardRef(function EditableColumn(
onEditStart = () => null,
editStatus = false,
validate = () => true,
...InputProps
} = props;

const [enabled, enableEdit] = useState<boolean | undefined>();
Expand Down Expand Up @@ -107,6 +109,7 @@ const EditableColumn = forwardRef(function EditableColumn(
value={value}
type={type}
onKeyUp={editHandler}
{...InputProps}
/>
</div>
)}
Expand Down
1 change: 1 addition & 0 deletions src/component/panels/MoleculesPanel/MoleculeHeader.tsx
Expand Up @@ -63,6 +63,7 @@ export default function MoleculeHeader(props: MoleculeHeaderProps) {
style={styles.labelInput}
validate={validateLabel}
onSave={(event) => saveLabelHandler(currentMolecule.id, event)}
maxLength={10}
/>
</div>

Expand Down

0 comments on commit 9a49474

Please sign in to comment.