-
Notifications
You must be signed in to change notification settings - Fork 51
Hds::Icon - Add support for predefined "foreground" colors in@color argument
#2302
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
Changes from all commits
bc692e8
6f24f32
567623e
e698eef
055a407
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,11 @@ | ||
| import Route from '@ember/routing/route'; | ||
|
|
||
| export default class IconRoute extends Route {} | ||
| import { AVAILABLE_COLORS } from '@hashicorp/design-system-components/components/hds/icon/index'; | ||
|
|
||
| export default class IconRoute extends Route { | ||
| model() { | ||
| return { | ||
| AVAILABLE_COLORS, | ||
| }; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,46 +42,71 @@ | |
| </SF.Item> | ||
| </Shw::Flex> | ||
|
|
||
| <Shw::Divider @level={{2}} /> | ||
| <Shw::Divider /> | ||
|
|
||
| <Shw::Text::H2>Color</Shw::Text::H2> | ||
|
|
||
| <Shw::Text::H4 @tag="h3">Color inheritance</Shw::Text::H4> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: you could just do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed that the @tag was changed initially. If you want the visual style of the smaller H4 here for some reason then this is fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| <Shw::Flex @direction="column" as |SF|> | ||
| <SF.Item as |SFI|> | ||
| <SFI.Label>Unspecified color (<code>currentColor</code>)</SFI.Label> | ||
| <Hds::Icon @name="bookmark" /> | ||
| <SFI.Label>unspecified color (<code>currentColor</code>)</SFI.Label> | ||
| <div> | ||
| <Hds::Icon @name="lock-fill" @size="24" /> | ||
| </div> | ||
| </SF.Item> | ||
| <SF.Item as |SFI|> | ||
| <SFI.Label>Custom red color, specified via <code>@color</code> argument</SFI.Label> | ||
| <Hds::Icon @name="folder-fill" @color="red" /> | ||
| <SF.Item as |SGI|> | ||
| <SGI.Label>parent with <code>#e12568</code> color</SGI.Label> | ||
| <div {{style color="#e12568"}}> | ||
| <Hds::Icon @name="lock-fill" @size="24" /> | ||
| </div> | ||
| </SF.Item> | ||
| <SF.Item as |SFI|> | ||
| <SFI.Label>Unspecified color (<code>currentColor</code>) + parent with custom blue color (to check inheritance)</SFI.Label> | ||
| <a {{style color="blue"}} href="#"> | ||
| <Hds::Icon @name="external-link" /> | ||
| </a> | ||
| </Shw::Flex> | ||
|
|
||
| <Shw::Divider @level={{2}} /> | ||
|
|
||
| <Shw::Text::H4 @tag="h3">Pre-defined colors</Shw::Text::H4> | ||
| <Shw::Grid @columns={{5}} as |SG|> | ||
| {{#each this.model.AVAILABLE_COLORS as |color|}} | ||
| <SG.Item @label={{color}}> | ||
| <div class="shw-component-icon-sample-color--{{color}}"> | ||
| <Hds::Icon @name="lock-fill" @color={{color}} @size="24" /> | ||
| </div> | ||
| </SG.Item> | ||
| {{/each}} | ||
| </Shw::Grid> | ||
|
|
||
| <Shw::Divider @level={{2}} /> | ||
|
|
||
| <Shw::Text::H4 @tag="h3">Custom colors</Shw::Text::H4> | ||
| <Shw::Flex @direction="column" as |SF|> | ||
| <SF.Item as |SGI|> | ||
| <SGI.Label><code>#e91e63</code></SGI.Label> | ||
| <Hds::Icon @name="lock-fill" @color="#e91e63" @size="24" /> | ||
| </SF.Item> | ||
| <SF.Item as |SFI|> | ||
| <SFI.Label>Custom orange color, specified via | ||
| <code>@color</code> | ||
| argument + parent with | ||
| <code>!important</code> | ||
| green color declared (to check overrides not working)</SFI.Label> | ||
| <SF.Item as |SGI|> | ||
| <SGI.Label><code>--token-color-palette-purple-400</code></SGI.Label> | ||
| <Hds::Icon @name="lock-fill" @color="var(--token-color-palette-purple-400)" @size="24" /> | ||
| </SF.Item> | ||
| <SF.Item as |SGI|> | ||
| <SGI.Label><code>orange</code> | ||
| + parent with | ||
| <code>green !important</code> | ||
| </SGI.Label> | ||
| {{! template-lint-disable no-inline-styles }} | ||
| <div style="color:green !important"> | ||
| <Hds::Icon @name="heart-fill" @color="orange" /> | ||
| <Hds::Icon @name="lock-fill" @color="orange" @size="24" /> | ||
| </div> | ||
| {{! template-lint-enable no-inline-styles }} | ||
| </SF.Item> | ||
| </Shw::Flex> | ||
|
|
||
| <Shw::Divider @level={{2}} /> | ||
| <Shw::Divider /> | ||
|
|
||
| <Shw::Text::H2>Display</Shw::Text::H2> | ||
|
|
||
| {{#let (array false true) as |booleans|}} | ||
| {{#each booleans as |isInline|}} | ||
| <Shw::Text::Body>{{if isInline "Inline" "Block (default)"}}</Shw::Text::Body> | ||
| <Shw::Text::H4 @tag="h3">{{if isInline "Inline" "Block (default)"}}</Shw::Text::H4> | ||
|
|
||
| <Shw::Flex class="shw-foundation-outline-icons" as |SF|> | ||
| <SF.Item @label="single icon"> | ||
|
|
||
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.
(question): wouldn't we want all of these to be HdsColorValues anyway? Is there a need to have them specifically in IconColorValues? It seems reasonable that if these are our ColorValues we'd want them available for everywhere that we use these values. WDYT?
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.
I thought about it, but I ended up keeping them separate for different reasons:
types.tsfile, underpackages/components/src/components/hds; not a big deal but maybe something we want to consider a bit moreso my thinking is that we can always do it, it's not something for this specific PR