-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add links in the homepage #11
Changes from 11 commits
9f615af
6c7b77a
e5e047f
76d451b
f53eb57
4c83c02
691d201
228cf8a
b98f277
a9e7be0
93609b2
0399498
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build | ||
node_modules | ||
.docusaurus | ||
*.css | ||
*.svg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"jest": true | ||
}, | ||
"globals": { | ||
"process": true, | ||
"global": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"], | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["react", "react-hooks", "prettier"], | ||
"rules": { | ||
"prettier/prettier": "error", | ||
"react/jsx-sort-props": [ | ||
2, | ||
{ | ||
"callbacksLast": true, | ||
"shorthandFirst": true, | ||
"reservedFirst": true | ||
} | ||
], | ||
"prefer-destructuring": [ | ||
"warn", | ||
{ | ||
"object": true, | ||
"array": false | ||
} | ||
], | ||
"no-console": "warn", | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "off" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ const config = { | |
crossorigin: 'anonymous' | ||
} | ||
], | ||
|
||
presets: [ | ||
[ | ||
'classic', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import {CardContent, CardMedia, Typography} from '@mui/material'; | ||
import {Blue} from '../../config/colors'; | ||
|
||
export const HomepageCard = ({title, text, img}) => { | ||
return ( | ||
<> | ||
<CardMedia | ||
component="img" | ||
height="60" | ||
title={title} | ||
image={`./img/${img}`} | ||
/> | ||
<CardContent> | ||
<Typography variant="h5" component="div" sx={{color: Blue['darkest']}}> | ||
{title} | ||
</Typography> | ||
<Typography | ||
variant="body2" | ||
sx={{color: Blue['darkest'], textTransform: 'capitalize'}} | ||
> | ||
{text} | ||
</Typography> | ||
</CardContent> | ||
</> | ||
); | ||
}; | ||
|
||
export default HomepageCard; | ||
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
import styles from './HomepageFeatures.module.css'; | ||
import {Button, Grid} from '@mui/material'; | ||
import HomepageCard from '../HomepageCard/HomepageCard'; | ||
import list from '../../config/home.json'; | ||
import {useHistory} from '@docusaurus/router'; | ||
|
||
const overrideLinkStyle = { | ||
flexFlow: 'column nowrap', | ||
width: '100%', | ||
minHeight: '100%', | ||
backgroundColor: '#fff', | ||
[':hover']: { | ||
boxShadow: '-1px 5px 19px 0px rgba(0,0,0,0.3)', | ||
backgroundColor: '#fff' | ||
} | ||
}; | ||
|
||
export const HomepageFeatures = () => { | ||
const history = useHistory(); | ||
dan-ziv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const renderCards = () => { | ||
const handleOnClick = linkName => history.push(linkName); | ||
const handleOnKeyDown = (event, linkName) => { | ||
if (event.key === 'Enter') { | ||
history.push(linkName); | ||
} | ||
}; | ||
return list.length | ||
? list.map(({linkName, ...props}, idx) => ( | ||
<Grid key={idx} item xs={8} md={4}> | ||
<Button | ||
variant="contained" | ||
onClick={() => handleOnClick(linkName)} | ||
onKeyDown={e => handleOnKeyDown(e, linkName)} | ||
sx={overrideLinkStyle} | ||
> | ||
<HomepageCard {...props} /> | ||
</Button> | ||
</Grid> | ||
)) | ||
: null; | ||
}; | ||
|
||
return ( | ||
<section className={styles.features}> | ||
<div className="container"> | ||
<div className="row"> | ||
<Grid | ||
container | ||
spacing={4} | ||
sx={{justifyContent: 'center', padding: '0 24px'}} | ||
> | ||
{renderCards()} | ||
</Grid> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
export default HomepageFeatures; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const Blue = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not in css file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'colors' should be reused between many files. Overriding mui-components is much easier using the 'sx' prop, than creating a ccs and importing it, and making sure in it to override relevant classes as seen on the browser (need to manually search the dom). |
||
main: '#3850e9', | ||
dark: 'rgb(25, 45, 160)', | ||
darker: 'rgb(14, 30, 122)', | ||
darkest: 'rgb(3, 13, 79)', | ||
light: 'rgb(126, 141, 238)', | ||
lighter: 'rgb(170, 179, 239)', | ||
lightest: 'rgb(243, 236, 247)' | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"linkName": "docs/CLI/commands", | ||
"img": "undraw_docusaurus_mountain.svg", | ||
"title": "what is starkNet", | ||
"text": "intrudaction to starknet: how it works, main concepts glossary, FAQs" | ||
}, | ||
{ | ||
"linkName": "docs/CLI/commands", | ||
"img": "undraw_docusaurus_tree.svg", | ||
"title": "building on starknet", | ||
"text": "useful link to help write and deploy your own contracts on starknet" | ||
}, | ||
{ | ||
"linkName": "docs/CLI/commands", | ||
"img": "undraw_docusaurus_react.svg", | ||
"title": "dev tools", | ||
"text": "tools for development and deployment" | ||
}, | ||
{ | ||
"linkName": "docs/CLI/commands", | ||
"img": "undraw_docusaurus_mountain.svg", | ||
"title": "discussions", | ||
"text": "starknet community discussions" | ||
}, | ||
{ | ||
"linkName": "docs/CLI/commands", | ||
"img": "undraw_docusaurus_tree.svg", | ||
"title": "block explorer", | ||
"text": "a link to Voyager, starknet alph block explorer" | ||
}, | ||
{ | ||
"linkName": "docs/CLI/commands", | ||
"img": "undraw_docusaurus_react.svg", | ||
"title": "latest updates", | ||
"text": "stay up to date with all the latest blog posts, news, and events" | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove