1
1
import React , { useState , useRef , useMemo } from 'react' ;
2
2
import { useStaticQuery , graphql } from 'gatsby' ;
3
- import { object , string } from 'yup' ;
3
+ import { object , string , boolean } from 'yup' ;
4
4
import { useLocation } from '@reach/router' ;
5
5
6
6
import Button from './Button' ;
@@ -31,7 +31,8 @@ const defaultState = {
31
31
authorUrl : '' ,
32
32
authorEmail : '' ,
33
33
authorTwitter : '' ,
34
- authorInstagram : ''
34
+ authorInstagram : '' ,
35
+ socialPermission : true
35
36
} ;
36
37
37
38
const schema = object ( {
@@ -44,7 +45,8 @@ const schema = object({
44
45
authorUrl : string ( ) . label ( 'Your website' ) . url ( ) ,
45
46
authorEmail : string ( ) . label ( 'Your email' ) ,
46
47
authorTwitter : string ( ) . label ( 'Twitter' ) ,
47
- authorInstagram : string ( ) . label ( 'Instagram' )
48
+ authorInstagram : string ( ) . label ( 'Instagram' ) ,
49
+ socialPermission : boolean ( ) . default ( true )
48
50
} ) ;
49
51
50
52
const useVideosWithShowcase = function ( ) {
@@ -355,6 +357,31 @@ const PassengerShowcaseForm = () => {
355
357
submission.)
356
358
</ span >
357
359
</ 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 >
358
385
< label >
359
386
Twitter
360
387
< input
0 commit comments