-
Notifications
You must be signed in to change notification settings - Fork 53
feat(menu): color prop and complex scheme #756
Conversation
ce57b6c
to
111b00f
Compare
/> | ||
) | ||
|
||
export default MenuExampleColor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for tracking @layershifter 's comment in: #712 (comment)
This example looks overcomplicated to me, may be we can:
- introduce a new
Select
knob- use it to get select an active color
will address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bare minimum examples
Reference SUIR for examples of clean Menu color examples. Let's not put so much information in a single example.
https://react.semantic-ui.com/collections/menu/#variations-colored
Definition only, avoid large permutations
The doc page should only be a "definition" of the component right now. That is a single example for each thing the menu can do, usually one example per prop.
At this point, let's not add examples for all possible permutations of what the menu can do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@levithomason
in SUIR there are not that many versions of Menus; I just introduced a Select Knob at @layershifter 's proposal and now we have examples that look like this:
TODO - introduce screenshot
We can separate these into different example files where we reuse the knob or we can add a knob on every example for the color, but because of the way knobs are implemented we need to have a .knobs.tsx
file for every example, which is a lot of duplication
what do you think?
@@ -229,6 +233,7 @@ class MenuItem extends AutoControlledComponent<ReactProps<MenuItemProps>, MenuIt | |||
{Menu.create(menu, { | |||
defaultProps: { | |||
accessibility: submenuBehavior, | |||
color, | |||
vertical: true, | |||
primary, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove primary
and secondary
props in MenuItem and Menu.tsx? And references to secondary
in menuItemStyles as part of this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do that, but I wanted to have a separate PR for it; it also needs to be discussed again; I'll update the comment after we sync
color: siteVars.gray02, | ||
focusedColor: siteVars.black, | ||
disabledColor: siteVars.gray06, | ||
primaryActiveColor: siteVars.white, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to get rid of specific variables like this primaryActiveColor
and just set primary.foreground.active
to siteVars.white
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flat variables are preferred for now for consistency, ease of merging, and ease of discovery.
Once we formalize the structure of our design system, we might have nested values like this. For now, let's keep consistent and flat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, does that mean we should have the flat variable inherit from the nested color scheme values? Or get rid of the color scheme nested values altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to have a meeting on color in the morning. This needs more discussion that is suitable in this PR's comments. It will likely be early, would you like to join?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add me to the invite. I would like to join if I can :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be updated after we discuss
primaryUnderlinedBorderColor: siteVars.gray08, | ||
|
||
disabledColor: siteVars.gray06, | ||
primaryActiveBorderColor: siteVars.brand, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will address after our sync
|
||
borderColor: siteVars.white, | ||
primaryBorderColor: siteVars.white, | ||
primaryActiveBorderColor: siteVars.white, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will address after our sync
if (active && !underlined) return {} | ||
|
||
if (underlined && !isFromKeyboard) { | ||
return { color: v.focusedColor } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little confusing because these variables are mixed with color scheme variables throughout the file. What is the right paradigm to follow? Do we use color scheme for everything, except when we need a specific exceptions or "override"? It looks like this might be the only time this variable is used. If so and if we're only using non-color scheme variables for specific instances, can we rename this variable to something specific like v.underlineInitialFocusedColor
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need this to be a variable because this specific color should not change with the color
prop (it's the same even if color is red
or green
)
regarding the name, it's debatable if we want to include something so specific... we need to come up with a naming convention for variables; if we take into account @codepretty 's proposal (underlineInitialFocusedColor
) we can find the pattern to be:
${propNames}${state}${area}Color
where:
propNames
: is a concatenation of props that are set to true for the branch the color is used;state
: is the state of the component (initial, focused, hovered, active, disabled, etc)area
: is the area of the component that gets the color (border, background, foreground, etc)
primaryActiveColor: siteVars.black, | ||
primaryFocusedColor: siteVars.black, | ||
|
||
backgroundColor: siteVars.black, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we not need color scheme in this file, but we do for the contrast variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before adding any more variables, let's nail down exactly why we need certain variables and make them consistent across components. To do this, we need user stories and requirements to fulfill.
We should probably have a focused effort on reviewing components and the usefulness of certain variables across many components. Once we have requirements and have spent some time designing a variable scheme to fill the requirements, we can then start adding more variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This complex color prop design is not inline with the current vision or principles. See #647 (comment).
Let's have a sync before merging any more of these changes.
10f9d42
to
f0e52fb
Compare
f0e52fb
to
c449916
Compare
Closing for now.Reasons:
Findings and TODOs:1. We need to drop complex color prop design and go back to the simpler API:<Menu color='string' ... /> TODO:
2. Flat variable names vs nested color scheme (comment: #756 (comment)) :
TODO:
3. How do we handle colors values that depend on prop values?Right now, the color scheme structure doesn't support that; it identifies only colors, areas (background, border, etc) and states (initial, hovered, active, etc) TODO:
4.
|
feat(menu): color scheme
Description
This PR:
color
prop toMenu
componentMenu
color examplesAPI
where
COLOR
can be:'primary' | 'secondary' | 'blue' | 'green' | 'grey' | 'orange' | 'pink' | 'purple' | 'teal' | 'red' | 'yellow' | string
'foreground' | 'background' | 'border'
to identify the target area of the componente.g.:
renders:

List of colored menu examples:
1. Regular theme
2. Dark theme