-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add colors variables for custom icon styling (#20)
- Loading branch information
Showing
55 changed files
with
5,718 additions
and
4,496 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
"@hopper-ui/icons-react16": major | ||
--- | ||
|
||
**Breaking Change**: Updated the icons variables to be more consistent with the other components. | ||
|
||
Will need to update the style sheets to use the new CSS variables. | ||
|
||
For example, they will need to replace: | ||
|
||
| Old variable | New variable | | ||
| ------------ | ------------ | | ||
| `--hop-richicon-placeholder-surface-color` | `--hop-Richicon-placeholder-shadow` | | ||
| `--hop-richicon-placeholder-icon-color` | `--hop-Richicon-placeholder-background` | | ||
| `--hop-richicon-placeholder-icon-strong-color` | `--hop-Richicon-placeholder-fill` | | ||
|
||
Add color variables for custom rich-icons styling | ||
|
||
to change the background color, use the variable `--hop-Richicon-placeholder-background` | ||
to change the shadow color, use the variable `--hop-Richicon-placeholder-shadow` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ | |
"type": "git", | ||
"url": "git+https://github.com/gsoft-inc/wl-hopper-react16.git" | ||
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "pnpm -r build ", | ||
"changeset": "changeset", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { XastElement } from "svgo/lib/types.js"; | ||
|
||
import { colors } from "./svgo-config.ts"; | ||
|
||
const colorsProps = new Set([ | ||
"color", | ||
"fill", | ||
"flood-color", | ||
"lighting-color", | ||
"stop-color", | ||
"stroke" | ||
]); | ||
|
||
export const changeColorPlugin = { | ||
name: "changeColorPlugin", | ||
description: "Change the color of the SVGs", | ||
fn: () => { | ||
return { | ||
element: { | ||
enter: (node: XastElement) => { | ||
for (const [nodeName, nodeValue] of Object.entries(node.attributes)) { | ||
if (colorsProps.has(nodeName)) { | ||
let value = nodeValue; | ||
|
||
if (colors[value]) { | ||
value = colors[value]; | ||
} | ||
node.attributes[nodeName] = value; | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
.hop-icon { | ||
color: inherit; | ||
fill: currentcolor; | ||
.hop-Icon { | ||
--hop-Icon-placeholder-primary-icon: var(--hop-primary-icon); | ||
--hop-Icon-placeholder-warning-icon-weak: var(--hop-warning-icon-weak); | ||
|
||
display: inline-block; | ||
pointer-events: none; | ||
flex-shrink: 0; | ||
color: inherit; | ||
fill: currentcolor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,57 @@ | ||
.hop-RichIcon { | ||
/* These tokens needs to match the ones defined in the generateComponents script */ | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option7-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option7-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option7-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option7-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
|
||
pointer-events: none; | ||
display: inline-block; | ||
flex-shrink: 0; | ||
} | ||
|
||
.hop-RichIcon--option1 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option1-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option1-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option1-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option1-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} | ||
|
||
.hop-RichIcon--option2 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option2-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option2-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option2-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option2-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} | ||
|
||
.hop-RichIcon--option3 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option3-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option3-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option3-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option3-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} | ||
|
||
.hop-RichIcon--option4 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option4-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option4-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option4-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option4-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} | ||
|
||
.hop-RichIcon--option5 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option5-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option5-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option5-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option5-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} | ||
|
||
.hop-RichIcon--option6 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option6-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option6-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option6-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option6-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} | ||
|
||
.hop-RichIcon--option7 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option7-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option7-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option7-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option7-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} | ||
|
||
.hop-RichIcon--option8 { | ||
--hop-richicon-placeholder-surface-color: var(--hop-decorative-option8-surface); | ||
--hop-richicon-placeholder-icon-color: var(--hop-decorative-option8-icon); | ||
--hop-richicon-placeholder-icon-strong-color: var(--hop-samoyed); | ||
--hop-Richicon-placeholder-shadow: var(--hop-decorative-option8-surface); | ||
--hop-Richicon-placeholder-background: var(--hop-decorative-option8-icon); | ||
--hop-Richicon-placeholder-fill: var(--hop-samoyed); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.