mirror of
https://github.com/strapi/strapi.git
synced 2025-09-28 18:01:26 +00:00
Enable active links in left menu
This commit is contained in:
parent
09302af45e
commit
d39c72a542
@ -23,7 +23,7 @@ class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<Link className={`${styles.link} ${this.props.isActive ? styles.linkActive : ''}`} to={this.props.destination}>
|
<Link className={styles.link} activeClassName={styles.linkActive} to={this.props.destination}>
|
||||||
<i className={`${styles.linkIcon} ${this.props.icon} ion`}></i>
|
<i className={`${styles.linkIcon} ${this.props.icon} ion`}></i>
|
||||||
<span className={styles.linkLabel}>{this.props.label}</span>
|
<span className={styles.linkLabel}>{this.props.label}</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -17,7 +17,6 @@ class LeftMenuLinkContainer extends React.Component { // eslint-disable-line rea
|
|||||||
icon={plugin.get('icon') || 'ion-merge'}
|
icon={plugin.get('icon') || 'ion-merge'}
|
||||||
label={plugin.get('name')}
|
label={plugin.get('name')}
|
||||||
destination={`/plugins/${plugin.get('id')}`}
|
destination={`/plugins/${plugin.get('id')}`}
|
||||||
isActive={this.props.params.plugin === plugin.get('id')}
|
|
||||||
leftMenuLinks={plugin.get('leftMenuLinks')}
|
leftMenuLinks={plugin.get('leftMenuLinks')}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
@ -11,8 +11,8 @@ import { Link } from 'react-router';
|
|||||||
class LeftMenuSubLink extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
class LeftMenuSubLink extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<li className={`${styles.leftMenuLink} ${this.props.isActive ? styles.leftMenuLinkActive : ''}`}>
|
<li className={styles.leftMenuLink}>
|
||||||
<Link className={styles.link} to={this.props.destination}>
|
<Link className={styles.link} to={this.props.destination} activeClassName={styles.linkActive}>
|
||||||
<span className={styles.linkLabel}>{this.props.label}</span>
|
<span className={styles.linkLabel}>{this.props.label}</span>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
@ -23,7 +23,6 @@ class LeftMenuSubLink extends React.Component { // eslint-disable-line react/pre
|
|||||||
LeftMenuSubLink.propTypes = {
|
LeftMenuSubLink.propTypes = {
|
||||||
label: React.PropTypes.string,
|
label: React.PropTypes.string,
|
||||||
destination: React.PropTypes.string,
|
destination: React.PropTypes.string,
|
||||||
isActive: React.PropTypes.bool,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LeftMenuSubLink;
|
export default LeftMenuSubLink;
|
||||||
|
@ -9,10 +9,6 @@
|
|||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftMenuLinkActive {
|
|
||||||
border-left: 0.4rem solid $strapi-blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
color: $left-menu-link-color;
|
color: $left-menu-link-color;
|
||||||
padding-left: 5.8rem;
|
padding-left: 5.8rem;
|
||||||
@ -25,6 +21,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.linkActive {
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
|
||||||
.linkLabel {
|
.linkLabel {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-right: 1rem;
|
padding-right: 1rem;
|
||||||
|
@ -16,7 +16,6 @@ class LeftMenuSubLinkContainer extends React.Component { // eslint-disable-line
|
|||||||
key={i}
|
key={i}
|
||||||
label={subLink.get('label')}
|
label={subLink.get('label')}
|
||||||
destination={`${this.props.destinationPrefix}/${subLink.get('to')}`}
|
destination={`${this.props.destinationPrefix}/${subLink.get('to')}`}
|
||||||
isActive={false}
|
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user