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

WSTEAM1-1011 UGC Form Submit Button #11613

Merged
merged 19 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/User-Experience/colours.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const LEGACY = [
export const CROSS_PLATFORM = [
{ colorName: 'SERVICE_NEUTRAL_CORE', colorCode: '#0071F1' },
{ colorName: 'SERVICE_NEUTRAL_LIGHT', colorCode: '#3092FF' },
{ colorName: 'SERVICE_NEUTRAL_DARK', colorCode: '#0064E6' },
{ colorName: 'SERVICE_NEUTRAL_DARK', colorCode: '#0051AD' },
{ colorName: 'LIVE_CORE', colorCode: '#009E9E' },
{ colorName: 'LIVE_LIGHT', colorCode: '#00CCC7' },
{ colorName: 'LIVE_DARK', colorCode: '#006666' },
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/ThemeProvider/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export const PHILIPPINE_GREY = '#8A8C8E';
export const POSTBOX = '#B80000';
export const POSTBOX_30 = '#EAB3B3';
export const RHINO = '#5A5A5A';
export const SERVICE_NEUTRAL_CORE = '#0071F1';
export const SERVICE_NEUTRAL_DARK = '#0051AD';
export const SHADOW = '#3F3F42';
export const SPORT_MIST = '#F7F7F5';
export const SPORT_SILVER = '#DBDBDB';
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/ThemeProvider/withThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import {
POSTBOX,
POSTBOX_30,
RHINO,
SERVICE_NEUTRAL_CORE,
SERVICE_NEUTRAL_DARK,
SHADOW,
SPORT_MIST,
SPORT_SILVER,
Expand Down Expand Up @@ -254,6 +256,8 @@ const withThemeProvider = ({
POSTBOX,
POSTBOX_30,
RHINO,
SERVICE_NEUTRAL_CORE,
SERVICE_NEUTRAL_DARK,
SHADOW,
SPORT_MIST,
SPORT_SILVER,
Expand Down
2 changes: 2 additions & 0 deletions src/app/models/types/theming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ interface Palette extends BrandPalette {
POSTBOX: string;
POSTBOX_30: string;
RHINO: string;
SERVICE_NEUTRAL_CORE: string;
SERVICE_NEUTRAL_DARK: string;
SHADOW: string;
SPORT_MIST: string;
SPORT_SILVER: string;
Expand Down
3 changes: 1 addition & 2 deletions ws-nextjs-app/pages/[service]/send/[id]/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export default function Form({
<form onSubmit={handleSubmit} noValidate>
{formFields}

{!submitted ? <Submit /> : <Loader />}

<Heading // TODO: need translations for this, it doesn't come through from the api
level={3}
css={styles.privacyHeading}
Expand All @@ -48,6 +46,7 @@ export default function Form({
dangerouslySetInnerHTML={{ __html: privacyNotice }}
css={styles.privacyNotice}
/>
{!submitted ? <Submit /> : <Loader />}
</form>
{submissionError && (
<div css={styles.submissionError}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,51 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SubmitButton should render a submit button with an associated label 1`] = `
<input
.emotion-0 {
background-color: #0071F1;
color: #FFFFFF;
width: 100%;
font-family: ReithSans,Helvetica,Arial,sans-serif;
font-style: normal;
font-weight: 400;
font-size: 0.9375rem;
line-height: 1.25rem;
border: none;
padding: 0.75rem 0;
margin-bottom: 1rem;
cursor: pointer;
}

@media (min-width: 20rem) and (max-width: 37.4375rem) {
.emotion-0 {
font-size: 1rem;
line-height: 1.375rem;
}
}

@media (min-width: 37.5rem) {
.emotion-0 {
margin-top: 0.5rem;
margin-bottom: 1.5rem;
}
}

.emotion-0:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
background-color: #0051AD;
}

@media (min-width: 15rem) {
.emotion-0 {
margin-bottom: 1.5rem;
}
}

<button
class="emotion-0"
type="submit"
value="Submit"
/>
>
Submit
</button>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('SubmitButton', () => {
return render(<SubmitButton />, { service: 'news' });
});

const button = container.querySelector('input[type=submit][value=Submit]');
const button = container.querySelector('button[type=submit]');

expect(button).toBeInTheDocument();
expect(button).toMatchSnapshot();
Expand Down
10 changes: 8 additions & 2 deletions ws-nextjs-app/pages/[service]/send/[id]/SubmitButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import React from 'react';
/** @jsx jsx */
import { jsx } from '@emotion/react';
import styles from './styles';

const Submit = () => {
const translation = 'Submit';
return <input type="submit" value={translation} />;
return (
<button css={styles.submit} type="submit">
{translation}
</button>
);
};

export default Submit;
27 changes: 27 additions & 0 deletions ws-nextjs-app/pages/[service]/send/[id]/SubmitButton/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Theme, css } from '@emotion/react';

export default {
submit: ({ palette, fontSizes, fontVariants, spacings, mq }: Theme) =>
css({
backgroundColor: palette.SERVICE_NEUTRAL_CORE,
color: palette.WHITE,
width: '100%',
...fontVariants.sansRegular,
emilysaffron marked this conversation as resolved.
Show resolved Hide resolved
...fontSizes.bodyCopy,
amoore108 marked this conversation as resolved.
Show resolved Hide resolved
border: 'none',
padding: `${spacings.FULL + spacings.HALF}rem 0`,
marginBottom: `${spacings.DOUBLE}rem`,
cursor: 'pointer',
'&:hover': {
emilysaffron marked this conversation as resolved.
Show resolved Hide resolved
textDecoration: 'underline',
backgroundColor: palette.SERVICE_NEUTRAL_DARK,
},
[mq.GROUP_1_MIN_WIDTH]: {
marginBottom: `${spacings.TRIPLE}rem`,
},
[mq.GROUP_3_MIN_WIDTH]: {
marginTop: `${spacings.FULL}rem`,
marginBottom: `${spacings.TRIPLE}rem`,
},
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('UGC Page Layout', () => {
});

it('Renders a submit button within the form', () => {
const submitButton = container.querySelector('form input[type=submit]');
const submitButton = container.querySelector('button[type=submit]');
expect(submitButton).toBeInTheDocument();
});
});