Skip to content

Commit d3b300a

Browse files
committed
adding the radio buttons
1 parent c506e0e commit d3b300a

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

src/components/PassengerShowcaseForm.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useRef, useMemo } from 'react';
22
import { useStaticQuery, graphql } from 'gatsby';
3-
import { object, string } from 'yup';
3+
import { object, string, boolean } from 'yup';
44
import { useLocation } from '@reach/router';
55

66
import Button from './Button';
@@ -31,7 +31,8 @@ const defaultState = {
3131
authorUrl: '',
3232
authorEmail: '',
3333
authorTwitter: '',
34-
authorInstagram: ''
34+
authorInstagram: '',
35+
socialPermission: true
3536
};
3637

3738
const schema = object({
@@ -44,7 +45,8 @@ const schema = object({
4445
authorUrl: string().label('Your website').url(),
4546
authorEmail: string().label('Your email'),
4647
authorTwitter: string().label('Twitter'),
47-
authorInstagram: string().label('Instagram')
48+
authorInstagram: string().label('Instagram'),
49+
socialPermission: boolean().default(true)
4850
});
4951

5052
const useVideosWithShowcase = function () {
@@ -355,6 +357,31 @@ const PassengerShowcaseForm = () => {
355357
submission.)
356358
</span>
357359
</label>
360+
<label>
361+
Social media permission
362+
<input
363+
type="radio"
364+
name="socialPermission"
365+
value="true"
366+
checked={state.socialPermission === true}
367+
onChange={onChange}
368+
/>
369+
<span>
370+
The Cafe Car: You have my permission to share this project to other
371+
Coding Train social media platforms!
372+
</span>
373+
<input
374+
type="radio"
375+
name="socialPermission"
376+
value="false"
377+
checked={state.socialPermission === false}
378+
onChange={onChange}
379+
/>
380+
<span>
381+
By private carriage: I prefer this project to be featured on the
382+
Coding Train website only.
383+
</span>
384+
</label>
358385
<label>
359386
Twitter
360387
<input

0 commit comments

Comments
 (0)