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

207 menu button color #208

merged 8 commits into from
Feb 28, 2024

Conversation

alishaevn
Copy link
Member

@alishaevn alishaevn commented Feb 27, 2024

story

create ability to customize the collapsed menu button color.

detailed explanation

move the default theme colors into a module.scss file
this move was done in preparation for allowing the toggle icon rendered
by the "navbar-toggler" class to be styled with the same colors as the
rest of the navbar. the colors exist in a "module.scss" file so that they
can be imported into our ".scss" AND ".jsx" files.

I also updated the colors from greyscale to match those in the webstore
template. greyscale was chosen initially as not to spend too much time
picking a color palette and distracting from component creation. using
color now allows us to see some of the slight color variances better.

use an editable svg as the navbar toggle icon
by default, the background image rendered by the "navbar-toggler-icon"
class is a dark colored hamburger menu icon. since it uses an image, it
was incapable of being dynamically styled with css alone. this commit
replaces the "navbar-toggler-icon" class inside "navbar-toggler" with an
editable svg, allowing us to change the color.

adjust navbar toggle behavior
for some reason after adding the custom ToggleIcon component to the Navbar,
the screen size that the navbar collapses at changed. It used to collapse
at <992px, but changed to <1232px. changing the expand prop to md
collapses the navbar at <1008px, which is closer to the original behavior.

overriding the spread radius for ".navbar-toggler:focus"
I would like to make it the same color as the icon too, but that isn't
possible dynamically with scss

demo

Screen.Recording.2024-02-27.at.02.03.43.PM.mp4

this move was done in preparation for allowing the toggle icon rendered
by the "navbar-toggler" class to be styled with the same colors as the
rest of the navbar. the colors exist in a "module.scss" file so that they
can be imported into our ".scss" AND ".jsx" files.

I also updated the colors from greyscale to match those in the webstore
template. greyscale was chosen initially as not to spend too much time
picking a color palette and distracting from component creation. using
color now allows us to see some of the slight color variances better.

- ref: #207
by default, the background image rendered by the "navbar-toggler-icon"
class is a dark colored hamburger menu icon. since it uses an image, it
was incapable of being dynamically styled with css alone. this commit
replaces the "navbar-toggler-icon" class inside "navbar-toggler" with an
editable svg, allowing us to change the color.

- ref: #207
for some reason after adding the custom ToggleIcon component to the Navbar,
the screen size that the navbar collapses at changed. It used to collapse
at <992px, but changed to <1232px. changing the `expand` prop to `md`
collapses the navbar at <1008px, which is closer to the original behavior.

ref: https://react-bootstrap.github.io/docs/components/navbar#responsive-behaviors
@alishaevn alishaevn linked an issue Feb 27, 2024 that may be closed by this pull request
1 task
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.

I would like to make it the same color as the icon too, but that isn't
possible dynamically with scss
Comment on lines +5 to +11
.navbar-toggler:focus {
text-decoration: none;
outline: 0;
// overriding the below to lessen the spread radius
// I would like to make it the same color as the icon, but that isn't possible dynamically with scss
box-shadow: 0 0 0 1px;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

before

image

after

image

Copy link
Collaborator

@labradford labradford left a comment

Choose a reason for hiding this comment

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

If I try to set the color to a rgb or hex value, there isn't a change. It only changes if I type in one of the color names in the default colors list. If that is intentional, could you make the selection a drop down list of colors rather than a color picker?

@alishaevn
Copy link
Member Author

alishaevn commented Feb 28, 2024

I'm unsure off the top of my head if I can make the storybook color picker a dropdown....but I can look into it.

@labradford updating the propTypes fixed this. great suggestion!

for some reason, with the `w-75` class, the "Sign In" text in the Header
was being shown on two lines. Not sure why, when this wasn't happening
yesterday. retested with tall and wide logos to make sure they still
are contained in the given area and don't distort.
@labradford labradford merged commit f402c2a into main Feb 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

editable menu color on mobile
3 participants