feat(navbar): Improvement in button and navbar
Closes #16946 feat(navbar): Added missing propType Closes #16946 feat(navbar): Updated as of required code format Closes #16946
This commit is contained in:
committed by
mrugesh mohapatra
parent
59f6581ab3
commit
d24f3ff175
@ -13,13 +13,13 @@ function LargeNav({ clickOnLogo, clickOnMap, shouldShowMapButton, panes }) {
|
|||||||
render={
|
render={
|
||||||
() => (
|
() => (
|
||||||
<Row>
|
<Row>
|
||||||
<Col className='nav-component' sm={ 4 } xs={ 6 }>
|
<Col className='nav-component' sm={ 5 } xs={ 6 }>
|
||||||
<Navbar.Header>
|
<Navbar.Header>
|
||||||
<NavLogo clickOnLogo={ clickOnLogo } />
|
<NavLogo clickOnLogo={ clickOnLogo } />
|
||||||
<FCCSearchBar />
|
<FCCSearchBar />
|
||||||
</Navbar.Header>
|
</Navbar.Header>
|
||||||
</Col>
|
</Col>
|
||||||
<Col className='nav-component bins' sm={ 4 } xs={ 6 }>
|
<Col className='nav-component bins' sm={ 3 } xs={ 6 }>
|
||||||
<BinButtons panes={ panes } />
|
<BinButtons panes={ panes } />
|
||||||
</Col>
|
</Col>
|
||||||
<Col className='nav-component nav-links' sm={ 4 } xs={ 0 }>
|
<Col className='nav-component nav-links' sm={ 4 } xs={ 0 }>
|
||||||
|
@ -11,17 +11,19 @@ import {
|
|||||||
clickOnLogo,
|
clickOnLogo,
|
||||||
clickOnMap
|
clickOnMap
|
||||||
} from './redux';
|
} from './redux';
|
||||||
import { panesSelector } from '../Panes/redux';
|
import { panesSelector, panesByNameSelector } from '../Panes/redux';
|
||||||
import propTypes from './navPropTypes';
|
import propTypes from './navPropTypes';
|
||||||
|
|
||||||
const mapStateToProps = createSelector(
|
const mapStateToProps = createSelector(
|
||||||
panesSelector,
|
panesSelector,
|
||||||
panes => {
|
panesByNameSelector,
|
||||||
|
(panes, panesByName) => {
|
||||||
return {
|
return {
|
||||||
panes: panes.map(({ name, type }) => {
|
panes: panes.map(({ name, type }) => {
|
||||||
return {
|
return {
|
||||||
content: name,
|
content: name,
|
||||||
action: type
|
action: type,
|
||||||
|
isHidden: panesByName[name].isHidden
|
||||||
};
|
};
|
||||||
}, {}),
|
}, {}),
|
||||||
shouldShowMapButton: panes.length === 0
|
shouldShowMapButton: panes.length === 0
|
||||||
|
@ -4,13 +4,14 @@ import { Button } from 'react-bootstrap';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
content: PropTypes.string,
|
content: PropTypes.string,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
handleClick: PropTypes.func.isRequired
|
handleClick: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function BinButton({ content, handleClick }) {
|
export default function BinButton({ content, handleClick, disabled }) {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
bsStyle='primary'
|
className={ disabled ? 'disabled-button' : 'enabled-button' }
|
||||||
onClick={ handleClick }
|
onClick={ handleClick }
|
||||||
>
|
>
|
||||||
{ content }
|
{ content }
|
||||||
|
@ -16,9 +16,10 @@ function BinButtons({ panes }) {
|
|||||||
return (
|
return (
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
{
|
{
|
||||||
panes.map(({ content, actionCreator }) => (
|
panes.map(({ content, actionCreator, isHidden }) => (
|
||||||
<BinButton
|
<BinButton
|
||||||
content={ content }
|
content={ content }
|
||||||
|
disabled={ isHidden }
|
||||||
handleClick={ actionCreator }
|
handleClick={ actionCreator }
|
||||||
key={ content }
|
key={ content }
|
||||||
/>
|
/>
|
||||||
|
@ -245,7 +245,7 @@ li.nav-avatar {
|
|||||||
|
|
||||||
|
|
||||||
&.nav-links {
|
&.nav-links {
|
||||||
justify-content: end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fcc_searchBar {
|
.fcc_searchBar {
|
||||||
@ -304,6 +304,13 @@ li.nav-avatar {
|
|||||||
|
|
||||||
.bins {
|
.bins {
|
||||||
|
|
||||||
|
.disabled-button {
|
||||||
|
color: whitesmoke;
|
||||||
|
}
|
||||||
|
.enabled-button {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
border-color: @brand-primary;
|
border-color: @brand-primary;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
Reference in New Issue
Block a user