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

Bug fixes, lower thresholds for consumption emissions and enhanced newletter form #506

Merged
merged 12 commits into from
May 10, 2024
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
25 changes: 20 additions & 5 deletions components/Footer/FooterNewsletterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const StyledParagraph = styled(Paragraph)`

const StyledForm = styled.form`
display: flex;
gap: 0.5rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid ${({ theme }) => theme.midGreen};
justify-content: space-between;
Expand All @@ -53,13 +54,25 @@ const StyledForm = styled.form`
flex-grow: 1;
`

const VisuallyHiddenLabel = styled.label`
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
`

const StyledInput = styled.input`
background: ${({ theme }) => theme.darkGreenOne};
border: none;
color: ${({ theme }) => theme.midGreen};
font-size: 16px;
font-family: 'Borna';
width: 100%;
padding: 0.5rem;

::placeholder,
::-webkit-input-placeholder {
Expand All @@ -79,6 +92,7 @@ const ArrowButton = styled.button`
border: none;
right: 0;
cursor: pointer;
padding: 0.25rem;
`

const EmailValidation = styled.div`
Expand Down Expand Up @@ -130,24 +144,25 @@ const NewsletterForm: FC<Props> = ({ status, onValidated }) => {
}

return (
<Container>
<H5>{t('footer.signup-form.title')}</H5>
<Container id="newsletter">
<H5>{t('common:footer.signup-form.title')}</H5>
<HorizontalContainer>
<div>
<StyledParagraph>
{t('footer.signup-form.info')}
{t('common:footer.signup-form.info')}
</StyledParagraph>
</div>
<div>
<StyledForm onSubmit={handleFormSubmit}>
{showThanks ? (
<EmailValidation>{t('footer.signup-form.thanks')}</EmailValidation>
<EmailValidation>{t('common:footer.signup-form.thanks')}</EmailValidation>
) : (
<>
<VisuallyHiddenLabel htmlFor="signup">{t('common:footer.signup-form.label')}</VisuallyHiddenLabel>
<StyledInput
onChange={(event) => setEmail(event.target.value)}
type="email"
placeholder={t('footer.signup-form.placeholder')}
placeholder={t('common:footer.signup-form.placeholder')}
value={email}
required
disabled={showThanks}
Expand Down
3 changes: 3 additions & 0 deletions data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## General information

### Getting started

Run `pip install -r requirements.txt` to install the required dependencies. If you're using Python 3, you can replace `pip` with `pip3`.

### Example calculation

Expand Down
7 changes: 6 additions & 1 deletion data/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
pandas
numpy
pandas
xlrd
openpyxl
pyarrow
scipy
pytest
5 changes: 0 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ module.exports = withBundleAnalyzer({
displayName: true,
},
},
// i18n configuration
i18n: {
locales: ['sv'],
defaultLocale: 'sv',
},
i18n,

// Redirects configuration
Expand Down
13 changes: 7 additions & 6 deletions public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
"source": "Källa: [Stockholm Environment Institute](https://www.sei.org/tools/konsumtionskompassen/)",
"title": "Konsumtionsutsläpp",
"labels": [
"7 ton +",
"6,7-7 ton",
"6,4-6,7 ton",
"6,1-6,4 ton",
"5,8-6,1 ton",
"5,8 ton -"
"6,4 ton +",
"6,2-6,4 ton",
"6-6,2 ton",
"5,8-6 ton",
"5,6-5,8 ton",
"5,6 ton -"
],
"name": "Konsumtionen"
},
Expand Down Expand Up @@ -106,6 +106,7 @@
"open-source": "öppen källkod",
"partners": "Partners",
"signup-form": {
"label": "Prenumerera på vårt nyhetsbrev",
"info": "Med vårt nyhetsbrev får du uppdateringar om hur det går med utsläppen och omställningen direkt i din mejl.",
"placeholder": "Ange mailadress",
"thanks": "Tack för ditt intresse!",
Expand Down
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ body {

html {
scroll-behavior: smooth;
/* The scroll padding should match the height of the fixed width header plus some offset to make it nicely aligned */
scroll-padding-top: 64px;
}

a {
Expand Down
2 changes: 1 addition & 1 deletion utils/datasetDefinitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function getTranslatedDataDescriptions(locale: string, _t: TFunction): DataDescr
title: t('common:datasets.consumption.title'),
body: t('common:datasets.consumption.body'),
source: t('common:datasets.consumption.source'),
boundaries: [7, 6.7, 6.4, 6.1, 5.8],
boundaries: [6.4, 6.2, 6, 5.8, 5.6],
labels:
t('common:datasets.consumption.labels', { returnObjects: true }) as unknown as string[],
labelRotateUp: [],
Expand Down
Loading