Skip to content

Commit

Permalink
feat(ProjectCreateForm): reorder form components
Browse files Browse the repository at this point in the history
  • Loading branch information
awinogradov committed Jun 9, 2023
1 parent dfafb0e commit 8bb15f4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"New project": "New project",
"Create project": "Create project",
"Title": "Title",
"Create": "Create",
"Cancel": "Cancel",
"Project title": "Project title",
"Short description": "Short description",
"Pro tip!": "Pro tip!",
"Press key to create project": "Press {key} to create project.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"New project": "Новый проект",
"Create project": "Создать проект",
"Title": "Название",
"Create": "Создать",
"Cancel": "Отмена",
"Project title": "Название проекта",
"Short description": "Короткое описание",
"Pro tip!": "Держи совет!",
"Press key to create project": "Нажми {key} чтобы создать проект.",
Expand Down
46 changes: 27 additions & 19 deletions src/components/ProjectCreateForm/ProjectCreateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ const StyledProjectKeyInputContainer = styled(InputContainer)`
padding-right: ${gapS};
`;

const StyledHelpIcon = styled(QuestionIcon)`
display: flex;
align-items: center;
`;

const ProjectCreateForm: React.FC = () => {
const router = useRouter();
const { locale } = usePageContext();
Expand Down Expand Up @@ -164,16 +169,12 @@ const ProjectCreateForm: React.FC = () => {

return (
<>
<ModalHeader>
<FormTitle>{tr('New project')}</FormTitle>
</ModalHeader>

<ModalContent>
<Form onSubmit={isKeyUnique ? handleSubmit(onCreateProject) : undefined}>
<StyledProjectTitleContainer>
<FormInput
{...register('title')}
placeholder={tr('Title')}
placeholder={tr('Project title')}
flat="bottom"
brick="right"
disabled={busy}
Expand Down Expand Up @@ -213,9 +214,10 @@ const ProjectCreateForm: React.FC = () => {

<FormTextarea
{...register('description')}
flat="both"
minHeight={100}
disabled={busy}
placeholder={tr('Short description')}
flat="both"
error={errorsResolver('description')}
/>

Expand All @@ -234,30 +236,36 @@ const ProjectCreateForm: React.FC = () => {
/>
)}
/>

<Link href={routes.help(locale, 'projects')}>
<StyledHelpIcon size="s" color={gray6} />
</Link>
</FormAction>
</FormActions>
<FormActions flat="top">
<FormAction left>
<Tip title={tr('Pro tip!')} icon={<BulbOnIcon size="s" color={gray10} />}>
{tr.raw('Press key to create project', {
key: <Keyboard command enter />,
})}
</Tip>
</FormAction>
<FormAction right inline>
<Button
outline
text={tr('Cancel')}
onClick={dispatchModalEvent(ModalEvent.ProjectCreateModal)}
/>
<Button
view="primary"
disabled={busy}
outline={!isValid || !isKeyUnique || !isKeyEnoughLength}
type="submit"
text={tr('Create project')}
text={tr('Create')}
/>
</FormAction>
</FormActions>
</Form>

<StyledFormBottom>
<Tip title={tr('Pro tip!')} icon={<BulbOnIcon size="s" color={gray10} />}>
{tr.raw('Press key to create project', {
key: <Keyboard command enter />,
})}
</Tip>

<Link href={routes.help(locale, 'projects')}>
<QuestionIcon size="s" color={gray6} />
</Link>
</StyledFormBottom>
</ModalContent>
</>
);
Expand Down

0 comments on commit 8bb15f4

Please sign in to comment.