Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 110 Character limit warning #117

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
--red: rgb(226, 0, 32);
--white: rgb(255, 255, 255);
--black: rgb(50, 58, 69);
--green: rgb(90, 196, 90);
--orange: rgb(255, 187, 79);
--main: var(--blue);
--mainDark: var(--darkBlue);
--accent: var(--gold);
--error: var(--red);
--success: rgb(90, 196, 90);
--warn: var(--orange);
--success: var(--green);
--background: var(--white);
--text: var(--black);
--formalFont: "Playfair Display", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
Expand Down
8 changes: 6 additions & 2 deletions src/views/CreateTemplate/CreateTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const EditorWrapper = styled.div`
padding: 1rem;
font-family: var(--formalFont);
`
const Warn = styled.div`
background: var(--warn);
padding: 1rem;
`

const CreateTemplate = (props: RouteComponentProps) => {
const [editorState, setEditorState] = useState(() => EditorState.createEmpty())
Expand Down Expand Up @@ -168,9 +172,9 @@ const CreateTemplate = (props: RouteComponentProps) => {
<SEO title="Mail a letter to your representative" description="Write and mail a letter to your representative." />
<form method="post" onSubmit={handleSubmit}>
{characterCount < 100 && (
<div>
<Warn>
<p>You have {characterCount} characters left. There is a 5,000 character limit.</p>
</div>
</Warn>
)}
<ErrorMessage error={error} />
<h2>Registered letter details</h2>
Expand Down