Skip to content

Commit

Permalink
0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
annabranco committed Dec 4, 2020
2 parents d509b6f + 5447db2 commit fc515ce
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nnk",
"version": "0.4.0",
"version": "0.5.0",
"private": true,
"description": "No Named Kitchen: Supporting People on the Move",
"repository": "https://github.com/annabranco/nnk",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/nnk/src/assets/images/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export const Photo07 = require('./spots/base07.png');
export const Photo08 = require('./spots/base08.png');
export const Photo09 = require('./spots/base09.jpeg');
export const VolunteersInAction = require('./spots/volunteers.jpeg');
export const CrossedFork = require('./icons/crossedFork.png');

// Partners
export const PayPal = require('./logos/paypal.png');
export const GoFundMe = require('./logos/gofundme.png');
export const Teaming = require('./logos/teaming.png');

// Partners
export const PayPal = require('./logos/paypal.png');
Expand Down
123 changes: 118 additions & 5 deletions packages/nnk/src/components/views/HelpUs/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import React, { Fragment, useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { connect } from 'frontity';
import SectionHeader from '../SectionHeader';
import config from '../../../setup/config';
import { getSocialLinks } from '../../../utils';
import { getSocialLinks, validateForm } from '../../../utils';
import { DONATION_TEXTS } from '../../../db';
import { Photo09, PayPal, GoFundMe, Teaming } from '../../../assets/images';
import {
Photo09,
PayPal,
GoFundMe,
Teaming,
CrossedFork
} from '../../../assets/images';
import {
Content,
SectionFooter,
FooterText,
FooterSeparator,
Section,
SubsectionWrapper,
Values,
Expand All @@ -20,15 +29,63 @@ import {
ItemDescription,
DonorBox,
Subscription,
ValueItem
ValueItem,
SubscriptionTitle,
FormArea,
Field,
Label,
TextField,
SendButton,
SubscriptionTitleHighlight
} from './styles';
import { StatePropType } from '../../../types';
import SocialModule from '../SocialContainer';

const HelpUs = ({ state }) => {
const { colors, language } = state.theme;
let texts = DONATION_TEXTS[language];
const socialLinks = getSocialLinks(['Facebook', 'Twitter', 'Instagram']);

const INITIAL_FORM_DATA = {
name: {
value: null,
isValid: false
},
email: {
value: null,
isValid: false
}
};

const [formData, setFormData] = useState(INITIAL_FORM_DATA);

const updateForm = (value, field) => {
const updatedData = { ...formData };
updatedData[field] = {
value,
isValid: validateForm(field, value)
};
setFormData(updatedData);
};

const sendEmail = event => {
event.preventDefault();
// eslint-disable-next-line no-undef
// Email.send({
// SecureToken: 'a8424171-6a2c-42f8-a17e-24ff3da22895',
// To: '[email protected]',
// From: '[email protected]',
// Subject: 'New volunteer contact',
// Body: `<html><h2>Contact</h2><p>Name: <strong>${formData.name.value}</strong></p><p>E-mail: <strong>${formData.email.value}</strong></p><p>Message: <em>${formData.message.value}</em></p></html>`
// }).then(message => {
// if (message === 'OK') {
// toggleEmailSent(true);
// } else {
// console.warn('Failed sending message though server', message);
// }
// });
};

useEffect(() => {
texts = DONATION_TEXTS[language];
}, [language]);
Expand Down Expand Up @@ -90,9 +147,65 @@ const HelpUs = ({ state }) => {
</SubsectionWrapper>
<SubsectionWrapper>
<DonorBox>DonorBox</DonorBox>
<Subscription>Subscribe!</Subscription>
<Subscription>
<SocialModule size="small" socialLinks={socialLinks} />
<SubscriptionTitle colors={colors}>
{texts.subscribeTo}
</SubscriptionTitle>
<SubscriptionTitleHighlight colors={colors}>
{texts.noNameNews}
</SubscriptionTitleHighlight>
<FormArea
colors={colors}
// action="mailto:[email protected]"
// method="post"
enctype="text/plain"
>
<Field>
<Label hidden htmlFor="name">
{texts.form.name}
</Label>
<TextField
onKeyUp={event => updateForm(event.target.value, 'name')}
id="name"
name="name"
placeholder={texts.form.name}
type="text"
/>
</Field>
<Field>
<Label hidden htmlFor="email">
{texts.form.email}
</Label>
<TextField
onKeyUp={event => updateForm(event.target.value, 'email')}
id="email"
name="email"
placeholder={texts.form.email}
type="email"
/>
</Field>
<SendButton
// type="submit"
// name="submit"
// value="Submit"
colors={colors}
onClick={sendEmail}
// disabled={!allValidated(formData)}
>
{texts.form.send}
</SendButton>
</FormArea>
</Subscription>
</SubsectionWrapper>
</Content>
<SectionFooter colors={colors}>
<FooterText>{texts.justice}</FooterText>
<FooterSeparator src={CrossedFork} />
<FooterText>{texts.hope}</FooterText>
<FooterSeparator src={CrossedFork} />
<FooterText>{texts.dignity}</FooterText>
</SectionFooter>
</Section>
);
};
Expand Down
131 changes: 122 additions & 9 deletions packages/nnk/src/components/views/HelpUs/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ import {
sizeSmallTitle,
sizeMediumTitle,
fontTitle,
sizeMedium
sizeMedium,
sizeSmall,
sizeXXLargeTitle,
sizeXLargeTitle
} from '../../../setup/themes';

export const Content = styled.div`
display: flex;
flex-direction: row;
align-items: center;
align-items: flex-start;
justify-content: center;
width: 60%;
width: 75%;
padding: 20px 80px;
`;
Content.displayName = 'Content';
Expand Down Expand Up @@ -110,10 +113,11 @@ export const SubsectionWrapper = styled.div`
flex-direction: column;
align-items: center;
justify-content: center;
width: 65%;
margin: 20px 30px;
width: 60%;
&:last-child {
width: 35%;
width: 40%;
}
`;
SubsectionWrapper.displayName = 'SubsectionWrapper';
Expand Down Expand Up @@ -152,13 +156,17 @@ export const PartnersLogos = styled.div`
PartnersLogos.displayName = 'PartnersLogos';

export const Logo = styled.img`
width: 100px;
margin: 20px 40px;
height: 70px;
`;
Logo.displayName = 'Logo';

export const TransferInfo = styled.div`
background: red;
margin: 30px auto;
width: 70%;
background: ${({ colors }) => colors && colors.terciary};
padding: 10px;
text-align: center;
color: ${({ colors }) => colors && colors.secondary};
`;
TransferInfo.displayName = 'TransferInfo';
Expand All @@ -180,12 +188,26 @@ export const ItemDescription = styled.span`
ItemDescription.displayName = 'ItemDescription';

export const DonorBox = styled.div`
border: 1px solid black;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border: 1px solid gray;
height: 400px;
width: 100%;
`;
DonorBox.displayName = 'DonorBox';

export const Subscription = styled.div`
border: 1px solid black;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 40px;
padding: 10px 0 0 90px;
border: 1px solid gray;
width: 100%;
`;
Subscription.displayName = 'Subscription';

Expand All @@ -194,3 +216,94 @@ export const ValueItem = styled.div`
padding: 10px;
`;
ValueItem.displayName = 'ValueItem';

export const SubscriptionTitle = styled(BaseTitle)`
color: ${({ colors }) => colors && colors.secondary};
`;
SubscriptionTitle.displayName = 'SubscriptionTitle';

export const SubscriptionTitleHighlight = styled(BaseTitle)`
color: ${({ colors }) => colors && colors.terciary};
`;
SubscriptionTitleHighlight.displayName = 'SubscriptionTitleHighlight';

export const FormArea = styled.form`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 10px auto;
width: 80%;
padding: 10px 0;
color: ${({ colors }) => colors && colors.secondary};
`;
FormArea.displayName = 'FormArea';

export const Field = styled.div`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 10px auto;
width: 100%;
`;
Field.displayName = 'Field';

export const Label = styled.label`
display: none;
`;
Label.displayName = 'Label';

export const TextField = styled.input`
height: 30px;
width: 82%;
background: gainsboro;
padding: 5px 20px;
font-weight: 400;
box-sizing: border-box;
font-size: ${sizeMedium};
`;
TextField.displayName = 'TextField';

export const SendButton = styled.button`
margin: 10px auto;
height: 30px;
width: 100px;
color: ${({ colors }) => colors && colors.secondary};
background: ${({ disabled, colors }) =>
disabled ? 'gray' : colors && colors.terciary};
text-transform: uppercase;
font-size: ${sizeSmall};
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
`;
SendButton.displayName = 'SendButton';

export const SectionFooter = styled.div`
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin: 0 auto 40px;
padding: 30px 5px;
width: 60%;
${({ colors }) =>
colors &&
css`
border-radius: 5px;
border-top: 2px solid ${colors.secondary};
border-bottom: 4px solid ${colors.secondary};
`};
`;
SectionFooter.displayName = 'SectionFooter';

export const FooterText = styled(BaseTitle)`
font-size: ${sizeXLargeTitle};
letter-spacing: 0.5rem;
`;
FooterText.displayName = 'FooterText';

export const FooterSeparator = styled.img`
width: 40px;
`;
FooterSeparator.displayName = 'FooterSeparator';
6 changes: 3 additions & 3 deletions packages/nnk/src/components/views/JumpToTheField/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const JumpToTheFieldSection = ({ state }) => {
enctype="text/plain"
>
<Field>
<Label for="name">{texts.form.fullName}</Label>
<Label htmlFor="name">{texts.form.fullName}</Label>
<TextField
onKeyUp={event => updateForm(event.target.value, 'name')}
id="name"
Expand All @@ -133,7 +133,7 @@ const JumpToTheFieldSection = ({ state }) => {
/>
</Field>
<Field>
<Label for="email">{texts.form.email}</Label>
<Label htmlFor="email">{texts.form.email}</Label>
<TextField
onKeyUp={event => updateForm(event.target.value, 'email')}
id="email"
Expand All @@ -142,7 +142,7 @@ const JumpToTheFieldSection = ({ state }) => {
/>
</Field>
<Field>
<Label for="message">{texts.form.message}</Label>
<Label htmlFor="message">{texts.form.message}</Label>
<MessageField
onKeyUp={event => updateForm(event.target.value, 'message')}
id="message"
Expand Down
Loading

0 comments on commit fc515ce

Please sign in to comment.