diff --git a/frontend/src/components/Teams/CreateTeam/TeamName.tsx b/frontend/src/components/Teams/CreateTeam/TeamName.tsx new file mode 100644 index 000000000..46ffbc11e --- /dev/null +++ b/frontend/src/components/Teams/CreateTeam/TeamName.tsx @@ -0,0 +1,26 @@ +import Input from '../../Primitives/Input'; +import Text from '../../Primitives/Text'; + +type Props = { teamName: string }; + +const TeamName = ({ teamName }: Props) => { + return ( + <> + + Team Name + + + + + ); +}; + +export default TeamName; diff --git a/frontend/src/components/Teams/CreateTeam/TipBar.tsx b/frontend/src/components/Teams/CreateTeam/TipBar.tsx new file mode 100644 index 000000000..c2dcc4478 --- /dev/null +++ b/frontend/src/components/Teams/CreateTeam/TipBar.tsx @@ -0,0 +1,51 @@ +import { styled } from 'styles/stitches/stitches.config'; + +import Icon from 'components/icons/Icon'; +import Flex from 'components/Primitives/Flex'; +import Text from 'components/Primitives/Text'; + +const TextWhite = styled(Text, { color: 'white', mt: '$24' }); +const LiWhite = styled('li', Text, { color: '$primary100', fontSize: '$14', lineHeight: '$20' }); + +const CreateTeamTipBar = () => { + return ( + + + Team Admin + + + You will be the team admin of this team. You can also choose other team admins later + on out of your team members. + + + + Stakeholders + + + If you select the role stakeholder, this person will not be included in + sub-team retros later on when you create a SPLIT retrospective. + + + ); +}; + +export default CreateTeamTipBar; diff --git a/frontend/src/components/icons/Sprite.tsx b/frontend/src/components/icons/Sprite.tsx index d4fb107f2..e1cd380ab 100644 --- a/frontend/src/components/icons/Sprite.tsx +++ b/frontend/src/components/icons/Sprite.tsx @@ -1,3 +1,5 @@ +/* eslint react/no-unknown-property: 0 */ + const Sprite = () => ( { )} {isTeams && ( - + Create new team diff --git a/frontend/src/pages/teams/new.tsx b/frontend/src/pages/teams/new.tsx new file mode 100644 index 000000000..01969d11b --- /dev/null +++ b/frontend/src/pages/teams/new.tsx @@ -0,0 +1,70 @@ +import { useCallback } from 'react'; +import { FormProvider, useForm, useWatch } from 'react-hook-form'; +import { NextPage } from 'next'; +import { useRouter } from 'next/router'; +import { joiResolver } from '@hookform/resolvers/joi/dist/joi'; + +import Icon from '../../components/icons/Icon'; +import Button from '../../components/Primitives/Button'; +import Text from '../../components/Primitives/Text'; +import TeamName from '../../components/Teams/CreateTeam/TeamName'; +import TipBar from '../../components/Teams/CreateTeam/TipBar'; +import SchemaCreateTeam from '../../schema/schemaCreateTeamForm'; +import { + Container, + ContentContainer, + InnerContent, + PageHeader, + StyledForm, + SubContainer +} from '../../styles/pages/boards/new.styles'; + +const NewTeam: NextPage = () => { + const router = useRouter(); + + const methods = useForm<{ text: string }>({ + mode: 'onBlur', + reValidateMode: 'onBlur', + defaultValues: { + text: '' + }, + resolver: joiResolver(SchemaCreateTeam) + }); + + const teamName = useWatch({ + control: methods.control, + name: 'text' + }); + + const handleBack = useCallback(() => { + router.back(); + }, [router]); + + return ( + + + + Create new team + + + + + + + + + + + + + + + + + + ); +}; + +export default NewTeam; diff --git a/frontend/src/schema/schemaCreateTeamForm.ts b/frontend/src/schema/schemaCreateTeamForm.ts new file mode 100644 index 000000000..0329d4fcc --- /dev/null +++ b/frontend/src/schema/schemaCreateTeamForm.ts @@ -0,0 +1,11 @@ +import Joi from 'joi'; + +const SchemaCreateTeam = Joi.object({ + text: Joi.string().required().trim().max(40).messages({ + 'any.required': 'Please enter the team name', + 'string.empty': 'Please enter the team name', + 'string.max': 'Maximum of 40 characters' + }) +}); + +export default SchemaCreateTeam;