@@ -5,6 +5,8 @@ import { themes, animations, layouts, fonts, colorValues, quoteTypes } from '../
55import TextField from '@material-ui/core/TextField' ;
66import Autocomplete from '@material-ui/lab/Autocomplete' ;
77import ContributorsCard from '../../ContributorsCard/ContributorCard'
8+ import useQuoteAuthors from '../../../util/authors' ;
9+
810const Home = ( ) => {
911
1012 const [ theme , setTheme ] = useState ( themes [ 0 ] ) ;
@@ -14,6 +16,9 @@ const Home = () => {
1416 const [ fontColor , setFontColor ] = useState ( null ) ;
1517 const [ bgColor , setBgColor ] = useState ( null ) ;
1618 const [ quoteType , setQuoteType ] = useState ( "random" ) ;
19+ const [ quoteAuthor , setQuoteAuthor ] = useState ( null ) ;
20+
21+ const { quoteAuthors } = useQuoteAuthors ( ) ;
1722
1823 return (
1924 < React . Fragment >
@@ -126,11 +131,24 @@ const Home = () => {
126131 />
127132 </ Grid >
128133
134+ < Grid item xs = { 12 } sm = { 6 } lg = { 3 } >
135+ < Autocomplete
136+ id = "author"
137+ options = { quoteAuthors }
138+ value = { quoteAuthor }
139+ style = { { width : 300 } }
140+ onChange = { ( _event , newValue ) => {
141+ setQuoteAuthor ( newValue )
142+ } }
143+ renderInput = { ( params ) => < TextField { ...params } label = "Author" placeholder = "Select an author" variant = "outlined" /> }
144+ />
145+ </ Grid >
146+
129147 </ Grid >
130148
131149 < Grid container spacing = { 4 } >
132150 < Grid item xs = { 12 } style = { { margin : '20px' } } >
133- < TemplateCard theme = { theme } animation = { animation } layout = { layout } font = { font } fontColor = { fontColor } bgColor = { bgColor } quoteType = { quoteType } />
151+ < TemplateCard theme = { theme } animation = { animation } layout = { layout } font = { font } fontColor = { fontColor } bgColor = { bgColor } quoteType = { quoteType } quoteAuthor = { quoteAuthor } />
134152 </ Grid >
135153 < Grid item xs = { 12 } >
136154 < Typography align = "center" > Other layouts</ Typography >
@@ -139,7 +157,7 @@ const Home = () => {
139157 layouts . filter ( ( item ) => item !== layout ) . map ( ( restLayout ) => {
140158 return (
141159 < Grid key = { restLayout } item xs = { 12 } sm = { 12 } md = { 6 } >
142- < TemplateCard theme = { theme } animation = { animation } layout = { restLayout } font = { font } fontColor = { fontColor } bgColor = { bgColor } quoteType = { quoteType } />
160+ < TemplateCard theme = { theme } animation = { animation } layout = { restLayout } font = { font } fontColor = { fontColor } bgColor = { bgColor } quoteType = { quoteType } quoteAuthor = { quoteAuthor } />
143161 </ Grid >
144162 )
145163 } )
0 commit comments