create breadcrumb component

link breadcrumb back project listing
This commit is contained in:
Barry Gitarts 2019-08-23 13:14:37 -04:00 committed by Barry G
parent f3ba805057
commit d752653ba4
4 changed files with 46 additions and 7 deletions

View File

@ -153,7 +153,6 @@ class PersistentDrawerLeft extends React.Component {
render() { render() {
const { classes, theme, loading, account, enableEthereum, location: { pathname, search } } = this.props const { classes, theme, loading, account, enableEthereum, location: { pathname, search } } = this.props
const { open } = this.state const { open } = this.state
console.log(this.props)
const isHome = pathname === "/" const isHome = pathname === "/"
const queryParams = queryString.parse(search) const queryParams = queryString.parse(search)

View File

@ -0,0 +1,36 @@
import React from 'react'
import PropTypes from 'prop-types'
import { withStyles } from '@material-ui/core/styles'
import { Link } from 'react-router-dom'
import classnames from 'classnames'
const styles = theme => ({
theme,
main: {
color: '#939BA1'
},
link: {
textDecoration: 'none',
color: '#939BA1'
}
})
function BreadCrumb({ classes, className, trail }){
const trailString = trail ? ` > ${trail.join(' > ')}` : ''
return (
<div className={classnames(classes.main, className)}>
<Link className={classes.link} to={'/'}>
All projects
</Link>
{<span>{trailString}</span>}
</div>
)
}
BreadCrumb.propTypes = {
classes: PropTypes.object.isRequired,
className: PropTypes.string,
trail: PropTypes.array
}
export default withStyles(styles)(BreadCrumb)

View File

@ -17,6 +17,7 @@ import { convertTokenAmountUsd } from '../../utils/prices'
import { setMediaType } from '../../utils/project' import { setMediaType } from '../../utils/project'
import MediaView from '../base/MediaView' import MediaView from '../base/MediaView'
import { isVideo } from '../../utils/images' import { isVideo } from '../../utils/images'
import BreadCrumb from '../base/BreadCrumb'
const { addProject } = LiquidPledging.methods const { addProject } = LiquidPledging.methods
@ -237,9 +238,10 @@ const SubmissionSection = ({ classes, history }) => {
return ( return (
<form onSubmit={handleSubmit} className={classes.submissionRoot}> <form onSubmit={handleSubmit} className={classes.submissionRoot}>
<div className={firstHalf}> <div className={firstHalf}>
<div className={classnames(classes.breadCrumb, fullWidth)}> <BreadCrumb
{'All projects and delegates > Create new'} className={fullWidth}
</div> trail={['Create new']}
/>
<StatusTextField <StatusTextField
className={fullWidth} className={fullWidth}
isRequired={true} isRequired={true}

View File

@ -20,6 +20,7 @@ import StatusTextField from '../base/TextField'
import { getProfileById } from './queries' import { getProfileById } from './queries'
import styles from './styles/FundProject' import styles from './styles/FundProject'
import Loading from '../base/Loading' import Loading from '../base/Loading'
import BreadCrumb from '../base/BreadCrumb'
const { addGiverAndDonate } = LiquidPledging.methods const { addGiverAndDonate } = LiquidPledging.methods
@ -93,9 +94,10 @@ const SubmissionSection = ({ classes, projectData, projectId, profileData, start
return ( return (
<form onSubmit={handleSubmit} className={classes.submissionRoot}> <form onSubmit={handleSubmit} className={classes.submissionRoot}>
{manifest && <div className={firstHalf}> {manifest && <div className={firstHalf}>
<div className={classnames(classes.breadCrumb, fullWidth)}> <BreadCrumb
{`All projects > ${manifest.title}`} className={fullWidth}
</div> trail={[manifest.title]}
/>
<Typography className={classes.projectTitle} component="h2" gutterBottom> <Typography className={classes.projectTitle} component="h2" gutterBottom>
{manifest && manifest.title} {manifest && manifest.title}
</Typography> </Typography>