Skip to content

Commit 68f739c

Browse files
authored
feat: add create organization overlay (#6327)
* feat: add create-org overlay to ui * chore: add types, fix filepath linting issue * chore: fix sizing of network alert * chore: fix type, move useEffect hooks up
1 parent 5bba520 commit 68f739c

File tree

10 files changed

+603
-6
lines changed

10 files changed

+603
-6
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@import '@influxdata/clockface/dist/variables.scss';
2+
3+
.create-org-overlay--createorg-input-element {
4+
input::-webkit-input-placeholder {
5+
font-style: italic;
6+
font-weight: normal !important;
7+
}
8+
}
9+
10+
.create-org-overlay--validation-field-placeholder {
11+
height: 20px;
12+
width: 200px;
13+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import React, {FC, useState} from 'react'
2+
import {
3+
ComponentSize,
4+
ComponentStatus,
5+
Form,
6+
Input,
7+
} from '@influxdata/clockface'
8+
9+
// Types
10+
import {OrgOverlayValidationError} from 'src/identity/components/GlobalHeader/GlobalHeaderDropdown/CreateOrganization/CreateOrganizationOverlay'
11+
12+
// Style
13+
import './CreateOrgInput.scss'
14+
15+
const formLabel = 'Organization Name'
16+
17+
interface Props {
18+
handleValidateOrgName: (orgName: string) => void
19+
orgName: string
20+
validationMsg: OrgOverlayValidationError
21+
}
22+
23+
export const CreateOrgInput: FC<Props> = ({
24+
handleValidateOrgName,
25+
orgName,
26+
validationMsg,
27+
}) => {
28+
const [userTouchedFormInput, setUserTouchedFormInput] = useState(false)
29+
30+
const handleInputChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
31+
if (!userTouchedFormInput) {
32+
setUserTouchedFormInput(true)
33+
}
34+
handleValidateOrgName(evt.target.value)
35+
}
36+
37+
const showError = validationMsg !== OrgOverlayValidationError.None
38+
39+
return (
40+
<>
41+
<Form.Element
42+
htmlFor={formLabel}
43+
label={formLabel}
44+
required={true}
45+
errorMessage={validationMsg}
46+
className="create-org-overlay--createorg-input-element"
47+
>
48+
<Form.HelpText text="You may want to create separate organizations for each team, server region, or dev environment." />
49+
<Input
50+
size={ComponentSize.Medium}
51+
onChange={handleInputChange}
52+
value={orgName}
53+
required={true}
54+
status={showError ? ComponentStatus.Error : ComponentStatus.Default}
55+
placeholder="Dev Team, US Eastern Region, Staging"
56+
/>
57+
</Form.Element>
58+
{!showError && (
59+
<div className="create-org-overlay--validation-field-placeholder" />
60+
)}
61+
</>
62+
)
63+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@import '@influxdata/clockface/dist/variables.scss';
2+
3+
.create-org-overlay--provider-box {
4+
display: flex;
5+
flex: 1;
6+
margin: 5px;
7+
border-radius: 5px;
8+
cursor: pointer;
9+
max-width: 350px;
10+
11+
> .create-org-overlay--provider-box-logo {
12+
display: flex;
13+
align-items: center;
14+
height: 120px;
15+
width: 100%;
16+
}
17+
}
18+
19+
.create-org-overlay--network-alert {
20+
margin-bottom: 12px;
21+
}
22+
23+
.create-org-overlay--provider-and-region-chooser {
24+
margin: 8px 0px;
25+
display: flex;
26+
27+
> .create-org-overlay--org-name {
28+
margin: 0px !important;
29+
> .create-org-overlay--help-text {
30+
margin: 0px 0 !important;
31+
}
32+
}
33+
34+
> .create-org-overlay--region-info {
35+
margin: 0px;
36+
}
37+
38+
.create-org-overlay--selectable-provider {
39+
margin: 15px 5px;
40+
height: 200px;
41+
42+
&:last-child {
43+
margin-right: 0px;
44+
}
45+
&:first-child {
46+
margin-left: 0px;
47+
}
48+
49+
&.selected {
50+
border-color: red;
51+
}
52+
}
53+
}
54+
55+
.create-org-overlay--loading-spinner {
56+
width: 800px;
57+
height: 50%;
58+
}

0 commit comments

Comments
 (0)