Skip to content
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

207 menu button color #208

Merged
merged 8 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/assets/svg/ToggleIcon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from 'react'
import themeColors from '../theme/default-colors.module.scss'

const ToggleIcon = ({ linkColor }, props) => (
<svg
xmlns='http://www.w3.org/2000/svg'
xmlSpace='preserve'
style={{
enableBackground: 'new 0 0 227 163.3',
}}
viewBox='0 0 227 163.3'
fill={themeColors[linkColor]}
width={25}
height={25}
{...props}
>
<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' />
</svg>
)

export default ToggleIcon
16 changes: 2 additions & 14 deletions src/assets/theme/bootstrap-preview.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
// 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.

$primary: #333333;
$secondary: #CCCCCC;
$success: #666666;
$info: #999999;
$warning: #2A2A2A;
$danger: #606060;
$light: #F8F9FA;
$dark: #212529;
$white: #FFFFFF;
$black: #000000;

// these imports must be AFTER the theme color overrides above in order to properly override bootstrap's colors, but before the theme maps.
@import './default-colors.module.scss';
// these imports must be AFTER the theme colors override import above in order to properly override bootstrap's colors, but before the theme maps.
@import '../../../node_modules/bootstrap/scss/functions';
@import '../../../node_modules/bootstrap/scss/variables';
@import '../../../node_modules/bootstrap/scss/mixins';
Expand Down
28 changes: 28 additions & 0 deletions src/assets/theme/default-colors.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* This file contains the color variables for the theme. Matching those in each webstore instance's "theme.module.scss" file.
*
* They exist in a "module.scss" file so that they can be imported into our ".scss" AND ".jsx" files.
*/
$primary: #614570;
$secondary: #936AAA;
$light: #F2F2F2;
$dark: #070818;
$success: #B0E298;
$info: #8eb3fc;
$warning: #E9DF00;
$danger: #D20000;
$black: #000000;
$white: #FFFFFF;

:export {
primary: $primary;
secondary: $secondary;
success: $success;
info: $info;
warning: $warning;
danger: $danger;
light: $light;
dark: $dark;
black: $black;
white: $white;
}
9 changes: 7 additions & 2 deletions src/compounds/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Container, Nav, Navbar } from 'react-bootstrap'
import ToggleIcon from '../../assets/svg/ToggleIcon'
import Logo from '../Logo/Logo'

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

return (
<Navbar bg='primary' expand='lg'>
<Navbar bg='primary' expand='md'>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes the changed media query after changing the toggle icon.

ref: this commit for more details.

<Container>
<Navbar.Brand className='w-50'>
<Logo src={src} alt={alt} height={45} />
</Navbar.Brand>
<Navbar.Toggle aria-controls='basic-navbar-nav' />
<Navbar.Toggle aria-controls='basic-navbar-nav'>
<ToggleIcon linkColor={linkColor} />
</Navbar.Toggle>
<Navbar.Collapse id='basic-navbar-nav'>
<Nav className='ms-auto'>
{navLinks.map((nav) => (
<Nav.Link
// ref https://github.com/twbs/bootstrap/blob/v5.2.3/scss/helpers/_colored-links.scss
// for how this className works
className={`link-${linkColor}`}
href={nav.path}
key={`${nav.label}-nav-link`}
Expand Down
Loading