-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from relaxxpls/master
[v1.6.0] Contact us page and success toasts
- Loading branch information
Showing
26 changed files
with
392 additions
and
198 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
# ? React env vars | ||
REACT_APP_VERSION=$npm_package_version | ||
REACT_APP_NAME=$npm_package_name | ||
|
||
# * Current environment, choices: ['development', 'production'] | ||
NODE_ENV=development | ||
# api config | ||
REACT_APP_API_HOST= | ||
|
||
# * For absolute imports | ||
NODE_PATH='src/' | ||
REACT_APP_SSO_CLIENT_ID= | ||
REACT_APP_SSO_REDIRECT_URI=http://localhost:3000/login |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,33 +1,90 @@ | ||
// import { useState } from 'react' | ||
import { Input } from 'antd' | ||
import { useState } from 'react' | ||
import styled from 'styled-components/macro' | ||
|
||
import { ButtonSquare, InputSquared, TextAreaSquared } from 'components/shared' | ||
import { DeveloperList } from 'components/Contact' | ||
import { | ||
ButtonSquare, | ||
Form, | ||
PageHeading, | ||
PageTitle, | ||
toast, | ||
} from 'components/shared' | ||
import { API } from 'config' | ||
|
||
const ContactContainer = () => { | ||
// const [state, setState] = useState(initalState) | ||
const [loading, setLoading] = useState(false) | ||
const [form] = Form.useForm() | ||
|
||
// const handleInput = (e) => { | ||
// const inputName = e.currentTarget.name | ||
// const value = e.currentTarget.value | ||
// setState((prev) => ({ ...prev, [inputName]: value })) | ||
// } | ||
const handleSubmit = async (payload) => { | ||
try { | ||
setLoading(true) | ||
await API.feedback.share({ payload }) | ||
toast({ status: 'success', content: 'Feedback shared successfully' }) | ||
form.resetFields() | ||
} catch (error) { | ||
toast({ status: 'error', content: error }) | ||
} finally { | ||
setLoading(false) | ||
} | ||
} | ||
|
||
return ( | ||
<ContainerForm> | ||
<InputSquared placeholder="Subject" type="text" /> | ||
<> | ||
<PageHeading> | ||
<PageTitle>Contact us</PageTitle> | ||
</PageHeading> | ||
|
||
<TextAreaSquared placeholder="Message" /> | ||
<StyledForm | ||
form={form} | ||
name="contact" | ||
onFinish={handleSubmit} | ||
layout="vertical" | ||
requiredMark={false} | ||
> | ||
<Form.Item | ||
name="subject" | ||
label="Subject" | ||
rules={[ | ||
{ required: true, message: 'Subject is required.' }, | ||
{ min: 3, message: 'Subject must be atleast 3 characters.' }, | ||
{ max: 100, message: 'Subject must be atmost 100 characters.' }, | ||
]} | ||
> | ||
<Input placeholder="Type something..." /> | ||
</Form.Item> | ||
|
||
<ButtonSquare type="submit">Send Message</ButtonSquare> | ||
</ContainerForm> | ||
<Form.Item name="message" label="Message"> | ||
<Input.TextArea | ||
autoSize={{ minRows: 1, maxRows: 10 }} | ||
placeholder="Type something..." | ||
rules={[ | ||
{ max: 1000, message: 'Message must be atmost 1000 characters.' }, | ||
]} | ||
/> | ||
</Form.Item> | ||
|
||
<div style={{ display: 'inline' }}> | ||
<ButtonSquare type="primary" htmlType="submit" loading={loading}> | ||
Submit | ||
</ButtonSquare> | ||
</div> | ||
</StyledForm> | ||
|
||
<DeveloperList /> | ||
</> | ||
) | ||
} | ||
|
||
const ContainerForm = styled.form` | ||
export default ContactContainer | ||
|
||
const StyledForm = styled(Form)` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1.5rem; | ||
padding: 1rem; | ||
background: ${({ theme }) => theme.secondary}; | ||
border-radius: 0.5rem; | ||
box-shadow: 0 0 0.5rem rgb(0 0 0 / 50%); | ||
margin-bottom: 1rem; | ||
` | ||
|
||
export default ContactContainer |
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
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
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
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
Oops, something went wrong.