11import React , { useState , useEffect } from "react" ;
2- import { makeStyles } from "@material-ui/core/styles" ;
2+ import { makeStyles , useTheme } from "@material-ui/core/styles" ;
33import Card from "@material-ui/core/Card" ;
44import CardActions from "@material-ui/core/CardActions" ;
55import CardContent from "@material-ui/core/CardContent" ;
66import Button from "@material-ui/core/Button" ;
77import Typography from "@material-ui/core/Typography" ;
88import Avatar from "@material-ui/core/Avatar" ;
9- import { contributorsUrl } from "../Constants/urlConfig"
9+ import { contributorsUrl } from "../Constants/urlConfig" ;
1010
11- const useStyles = makeStyles ( {
12- root : {
13- // minWidth: 275,
14- maxWidth : 400 ,
15- padding : 10 ,
16- margin : 10
17- } ,
18- bullet : {
19- display : "inline-block" ,
20- margin : "0 2px" ,
21- transform : "scale(0.8)" ,
11+ // Helper function to check if a color is a gradient or image URL
12+ const isComplexBackground = ( bg ) => bg && ( bg . includes ( 'gradient' ) || bg . includes ( 'url' ) ) ;
13+
14+
15+ // 3. Update makeStyles to use SELECTED_THEME colors
16+ const useStyles = makeStyles ( theme => ( {
17+ root : {
18+ maxWidth : 650 ,
19+ padding : theme . spacing ( 3 ) , // Use theme spacing for consistency (24px)
20+ margin : theme . spacing ( 2 ) , // Use theme spacing for consistency (16px)
21+
22+ // MODERNIZED BACKGROUND GRADIENT
23+ background : theme . palette . type === 'dark'
24+ ? 'linear-gradient(135deg, #1c2128 0%, #0d1117 100%)' // Slightly adjusted dark gradient
25+ : 'linear-gradient(135deg, #ffffff 0%, #f7f7f7 100%)' , // Softer light gradient
26+
27+ borderRadius : 12 , // Slightly reduced border radius for a modern feel
28+ transition : 'transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)' ,
29+ border : theme . palette . type === 'dark' ? '1px solid #30363d' : '1px solid #e1e4e8' , // Added subtle light mode border
30+
31+ '&:hover' : {
32+ transform : 'translateY(-6px)' , // Deeper lift on hover
33+ // MODERN SHADOW: Use a more diffused shadow for a 3D-pop effect
34+ boxShadow : theme . palette . type === 'dark'
35+ ? '0 15px 30px rgba(0,0,0,0.45)'
36+ : '0 15px 30px rgba(0,0,0,0.15)' ,
37+ }
38+ } ,
39+ title : {
40+ fontSize : '1.75rem' , // Larger, more impactful title
41+ fontWeight : 700 , // Bolder font weight
42+ marginBottom : theme . spacing ( 1 ) , // Reduced margin below for tighter grouping
43+ // SLIGHTLY BRIGHTER TEXT FOR DARK MODE CONTRAST
44+ color : theme . palette . type === 'dark' ? '#f0f6fc' : theme . palette . text . primary ,
45+ textAlign : 'center'
46+ } ,
47+ subtitle : {
48+ fontSize : '1rem' , // Standard font size
49+ // MORE SUBDUED TEXT FOR LIGHT MODE
50+ color : theme . palette . type === 'dark' ? theme . palette . text . secondary : '#6a737d' ,
51+ textAlign : 'center' ,
52+ marginBottom : theme . spacing ( 4 ) , // Increased margin below subtitle
53+ } ,
54+ avatarContainer : {
55+ display : 'flex' ,
56+ flexWrap : 'wrap' ,
57+ justifyContent : 'center' ,
58+ gap : theme . spacing ( 1.5 ) , // Tighter gap between avatars
59+ marginTop : theme . spacing ( 2 ) ,
60+ marginBottom : theme . spacing ( 3 ) ,
2261 } ,
23- title : {
24- fontSize : 14 ,
62+ avatar : {
63+ width : 50 ,
64+ height : 50 ,
65+ borderRadius : '50%' , // Explicitly ensure circular
66+ border : theme . palette . type === 'dark' ? '2px solid #2ea043' : '2px solid #2196F3' , // Subtle color ring
67+ transition : 'transform 0.2s ease, box-shadow 0.2s ease' ,
68+ '&:hover' : {
69+ transform : 'scale(1.18)' , // Slightly larger scale up
70+ boxShadow : '0 6px 12px rgba(0,0,0,0.3)' , // Sharper shadow on individual hover
71+ zIndex : 1 ,
72+ }
2573 } ,
26- pos : {
27- marginBottom : 12 ,
74+ button : {
75+ borderRadius : 25 , // More rounded, 'pill' shape
76+ padding : '10px 30px' , // More vertical padding
77+ textTransform : 'none' ,
78+ fontWeight : 600 ,
79+ color : '#ffffff' ,
80+
81+ // UPDATED DARK MODE BUTTON TO SOFTER GREEN (More like GitHub actions)
82+ background : theme . palette . type === 'dark'
83+ ? 'linear-gradient(45deg, #2ea043 30%, #34bf49 90%)' // Green gradient
84+ : 'linear-gradient(45deg, #1877f2 30%, #21a9f3 90%)' , // Facebook-blue gradient for light mode
85+
86+ // MODERN SHADOW FOR BUTTON
87+ boxShadow : theme . palette . type === 'dark'
88+ ? '0 6px 10px 0 rgba(46, 160, 67, 0.4)'
89+ : '0 6px 10px 0 rgba(33, 150, 243, 0.4)' ,
90+
91+ '&:hover' : {
92+ // Slightly change gradient direction on hover
93+ background : theme . palette . type === 'dark'
94+ ? 'linear-gradient(45deg, #34bf49 30%, #2ea043 90%)'
95+ : 'linear-gradient(45deg, #21a9f3 30%, #1877f2 90%)' ,
96+ boxShadow : theme . palette . type === 'dark'
97+ ? '0 4px 8px 0 rgba(46, 160, 67, 0.6)'
98+ : '0 4px 8px 0 rgba(33, 150, 243, 0.6)' ,
99+ }
28100 } ,
29- } ) ;
101+ cardActions : {
102+ justifyContent : 'center' ,
103+ padding : theme . spacing ( 2 , 0 ) , // Use theme spacing
104+ }
105+ } ) ) ;
30106
31107const ContributorsCard = ( ) => {
32108 const [ listOfContributors , setListOfContributors ] = useState ( [ ] ) ;
109+ const theme = useTheme ( ) ;
110+
111+ const classes = useStyles ( ) ;
33112
34113 useEffect ( ( ) => {
35114 fetchContributors ( ) ;
@@ -43,57 +122,79 @@ const ContributorsCard = () => {
43122 throw new Error ( 'Failed to fetch contributors' ) ;
44123 }
45124 const data = await res . json ( ) ;
46- setListOfContributors ( data ) ;
125+ if ( Array . isArray ( data ) ) {
126+ setListOfContributors ( data ) ;
127+ } else {
128+ console . error ( 'Fetched data is not an array:' , data ) ;
129+ setListOfContributors ( [ ] ) ;
130+ }
47131 } catch ( error ) {
48132 console . error ( 'Error fetching contributors:' , error ) ;
133+ setListOfContributors ( [ ] ) ;
49134 }
50135 } ;
51136
52- const classes = useStyles ( ) ;
53-
54137 return (
55138 < div
56139 style = { {
57140 display : "flex" ,
58- margin :"10px ",
141+ margin : "20px ",
59142 justifyContent : "center" ,
60143 alignItems : "center" ,
61144 } }
62145 >
63146 < Card raised className = { classes . root } >
64147 < CardContent >
65- A Special Thanks To All The Contributors!
66- < Typography variant = "h5" component = "h2" >
67- We are grateful{ " " }
68- < span role = "img" aria-label = "sheep" >
148+ < Typography className = { classes . title } variant = "h5" component = "h2" >
149+ A Special Thanks To All The Contributors!{ " " }
150+ < span
151+ role = "img"
152+ aria-label = "heart"
153+ style = { {
154+ fontSize : '28px' ,
155+ // Added a slight filter for a modern glow in dark mode
156+ filter : theme . palette . type === 'dark' ? 'drop-shadow(0 0 4px #ff5050)' : 'none'
157+ } }
158+ >
69159 ❤️
70160 </ span >
71161 </ Typography >
72- < Typography className = { classes . pos } color = "textSecondary" >
73- To our { listOfContributors . length } contributors for helping in
74- < br />
75- bringing this project to life
162+ < Typography className = { classes . subtitle } color = "textSecondary" >
163+ We are grateful to our { listOfContributors . length } amazing contributors
164+ for bringing this project to life
76165 </ Typography >
77166
78- < div style = { { display :'flex' , alignItems :'center' } } >
79-
167+ < div className = { classes . avatarContainer } >
80168 {
81- listOfContributors . slice ( 0 , Math . min ( listOfContributors . length , 7 ) ) . map ( ( contributor ) => {
169+ listOfContributors . slice ( 0 , Math . min ( listOfContributors . length , 8 ) ) . map ( ( contributor ) => {
82170 return (
83- < Avatar key = { contributor . id } style = { { marginRight :'5px' , marginLeft :'5px' } } alt = { contributor . login } src = { contributor . avatar_url } />
171+ < Avatar
172+ key = { contributor . id }
173+ className = { classes . avatar }
174+ alt = { contributor . login }
175+ src = { contributor . avatar_url }
176+ title = { contributor . login }
177+ />
84178 )
85179 } )
86180 }
87181 </ div >
88182 </ CardContent >
89- < CardActions >
90- < a style = { { textDecoration :"none" } } href = "https://github.com/zhravan/github-readme-quotes/graphs/contributors" >
91- < Button variant = "contained" color = "primary" size = "small" > More Details Here</ Button >
183+ < CardActions className = { classes . cardActions } >
184+ < a style = { { textDecoration :"none" } } href = "https://github.com/zhravan/github-readme-quotes/graphs/contributors" >
185+ < Button
186+ variant = "contained"
187+ color = "primary"
188+ className = { classes . button }
189+ size = "large"
190+ >
191+ View All Contributors
192+ </ Button >
92193 </ a >
93194 </ CardActions >
94195 </ Card >
95196 </ div >
96197 ) ;
97198} ;
98199
99- export default ContributorsCard ;
200+ export default ContributorsCard ;
0 commit comments