forked from processing/p5.js-web-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa3b454
commit a49f834
Showing
2 changed files
with
30 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useSelector } from 'react-redux'; | ||
import { useSketchActions } from '../../hooks'; | ||
import { selectProjectName } from '../../selectors/project'; | ||
import EditableInput from '../EditableInput'; | ||
|
||
export default function ProjectName() { | ||
const { t } = useTranslation(); | ||
|
||
const { changeSketchName, canEditProjectName } = useSketchActions(); | ||
|
||
const projectName = useSelector(selectProjectName); | ||
|
||
return ( | ||
<EditableInput | ||
value={projectName} | ||
disabled={!canEditProjectName} | ||
aria-label={t('Toolbar.EditSketchARIA')} | ||
inputProps={{ | ||
maxLength: 128, | ||
'aria-label': t('Toolbar.NewSketchNameARIA') | ||
}} | ||
validate={(text) => text.trim().length > 0} | ||
onChange={changeSketchName} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters