Skip to content

Commit f402c2a

Browse files
authored
Merge pull request #208 from scientist-softserv/207-menu-button-color
207 menu button color
2 parents f2b84fd + 8c27059 commit f402c2a

File tree

5 files changed

+70
-18
lines changed

5 files changed

+70
-18
lines changed

src/assets/svg/ToggleIcon.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as React from 'react'
2+
import themeColors from '../theme/default-colors.module.scss'
3+
4+
const ToggleIcon = ({ linkColor }, props) => (
5+
<svg
6+
xmlns='http://www.w3.org/2000/svg'
7+
xmlSpace='preserve'
8+
style={{
9+
enableBackground: 'new 0 0 227 163.3',
10+
}}
11+
viewBox='0 0 227 163.3'
12+
fill={themeColors[linkColor]}
13+
width={25}
14+
height={25}
15+
{...props}
16+
>
17+
<path d='M113.1 33h-95C5.8 33-2.1 22.1 2.2 11.3 4.6 5.2 9.3 1.8 15.8 1.1c1.5-.2 3-.1 4.5-.1h185.5c2.2 0 4.4-.1 6.5.3 8.1 1.6 13.6 9.2 12.7 17.2-.8 8.1-7.5 14.3-15.9 14.3-21 .1-42 0-63 .1-11 .1-22 .1-33 .1zM113 65h95c12.7 0 20.7 11.7 15.6 22.6-3.1 6.6-8.5 9.4-15.7 9.4H18.4C5.8 97-2.2 86 2.2 75.1c2.6-6.4 8.3-10 16.3-10.1H113zM113.3 129c31.7 0 63.3-.1 95 0 13.2 0 21.1 13.3 14.5 24.1-3.5 5.8-9 7.9-15.7 7.9-45.8-.1-91.7 0-137.5 0H19.1c-10.7 0-17.9-6.4-18-15.9C1 135.5 8.3 129 19.3 129h94z' />
18+
</svg>
19+
)
20+
21+
export default ToggleIcon

src/assets/theme/bootstrap-preview.scss

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
// these colors and variables match what is in the webstore's theme.module.scss file. this file enables us to see the preview of what these overrides will look like without actually importing these from here into the webstore project. In order to see a preview in storybook of how components will look with custom colors, these values must be updated.
2-
3-
$primary: #333333;
4-
$secondary: #CCCCCC;
5-
$success: #666666;
6-
$info: #999999;
7-
$warning: #2A2A2A;
8-
$danger: #606060;
9-
$light: #F8F9FA;
10-
$dark: #212529;
11-
$white: #FFFFFF;
12-
$black: #000000;
13-
14-
// these imports must be AFTER the theme color overrides above in order to properly override bootstrap's colors, but before the theme maps.
1+
@import './default-colors.module.scss';
2+
// these imports must be AFTER the theme colors override import above in order to properly override bootstrap's colors, but before the theme maps.
153
@import '../../../node_modules/bootstrap/scss/functions';
164
@import '../../../node_modules/bootstrap/scss/variables';
175
@import '../../../node_modules/bootstrap/scss/mixins';
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* This file contains the color variables for the theme. Matching those in each webstore instance's "theme.module.scss" file.
3+
*
4+
* They exist in a "module.scss" file so that they can be imported into our ".scss" AND ".jsx" files.
5+
*/
6+
$primary: #614570;
7+
$secondary: #936AAA;
8+
$light: #F2F2F2;
9+
$dark: #070818;
10+
$success: #B0E298;
11+
$info: #8eb3fc;
12+
$warning: #E9DF00;
13+
$danger: #D20000;
14+
$black: #000000;
15+
$white: #FFFFFF;
16+
17+
:export {
18+
primary: $primary;
19+
secondary: $secondary;
20+
success: $success;
21+
info: $info;
22+
warning: $warning;
23+
danger: $danger;
24+
light: $light;
25+
dark: $dark;
26+
black: $black;
27+
white: $white;
28+
}

src/compounds/Header/Header.jsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
33
import { Container, Nav, Navbar } from 'react-bootstrap'
4+
import ToggleIcon from '../../assets/svg/ToggleIcon'
45
import Logo from '../Logo/Logo'
56
import './styles.scss'
67

78
const Header = ({ auth, linkColor, logo, navLinks, userSession }) => {
89
const { src, alt } = logo
910

1011
return (
11-
<Navbar bg='primary' expand='lg'>
12+
<Navbar bg='primary' expand='md'>
1213
<Container>
13-
<Navbar.Brand className='w-75 custom-navbar-brand'>
14+
<Navbar.Brand className='w-50 custom-navbar-brand'>
1415
<Logo src={src} alt={alt} height='auto' addClass='mw-100 mh-100' />
1516
</Navbar.Brand>
16-
<Navbar.Toggle aria-controls='basic-navbar-nav' />
17+
<Navbar.Toggle aria-controls='basic-navbar-nav'>
18+
<ToggleIcon linkColor={linkColor} />
19+
</Navbar.Toggle>
1720
<Navbar.Collapse id='basic-navbar-nav'>
1821
<Nav className='ms-auto'>
1922
{navLinks.map((nav) => (
2023
<Nav.Link
24+
// ref https://github.com/twbs/bootstrap/blob/v5.2.3/scss/helpers/_colored-links.scss
25+
// for how this className works
2126
className={`link-${linkColor}`}
2227
href={nav.path}
2328
key={`${nav.label}-nav-link`}
@@ -43,7 +48,9 @@ Header.propTypes = {
4348
signIn: PropTypes.func.isRequired,
4449
signOut: PropTypes.func.isRequired,
4550
}).isRequired,
46-
linkColor: PropTypes.string,
51+
linkColor: PropTypes.oneOf([
52+
'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'light', 'dark', 'black', 'white'
53+
]),
4754
logo: PropTypes.shape({
4855
src: PropTypes.string.isRequired,
4956
alt: PropTypes.string,

src/compounds/Header/styles.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
.custom-navbar-brand {
22
height: 45px;
33
}
4+
5+
.navbar-toggler:focus {
6+
text-decoration: none;
7+
outline: 0;
8+
// overriding the below to lessen the spread radius
9+
// I would like to make it the same color as the icon, but that isn't possible dynamically with scss
10+
box-shadow: 0 0 0 1px;
11+
}

0 commit comments

Comments
 (0)