forked from SymphonyPlatformSolutions/symphony-ui-toolkit
-
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.
APP-4244 - Export var and create utils class (#103)
- Loading branch information
1 parent
a4cd942
commit 2d4c143
Showing
8 changed files
with
214 additions
and
133 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,31 +1,25 @@ | ||
.tk-color-action-primary { | ||
color: $scolor-electricity !important; | ||
} | ||
.tk-color-action-ok { | ||
color: $scolor-green !important; | ||
} | ||
$colorMap: ( | ||
"primary": $scolor-electricity, | ||
"ok": $scolor-green, | ||
"attention": $scolor-orange, | ||
"warning": $--tk-color-error, | ||
); | ||
|
||
.tk-color-action-attention { | ||
color: $scolor-orange !important; | ||
} | ||
|
||
.tk-color-action-warning { | ||
color: $--tk-color-error !important; | ||
@each $name, $color in $colorMap { | ||
.tk-color-action-#{$name} { | ||
color: $color !important; | ||
} | ||
.tk-text-color-#{$name} { // deprecated | ||
color: $color !important; | ||
} | ||
.tk-text-color--#{$name} { | ||
color: $color !important; | ||
} | ||
.tk-bg-color--#{$name} { | ||
background-color: $color !important; | ||
} | ||
} | ||
|
||
.tk-text-color { | ||
color: $--tk-main-text-color; | ||
|
||
&--warning { | ||
@extend .tk-color-action-warning; | ||
} | ||
&--ok { | ||
@extend .tk-color-action-ok; | ||
} | ||
&--attention { | ||
@extend .tk-color-action-attention; | ||
} | ||
&--primary { | ||
@extend .tk-color-action-primary; | ||
} | ||
} |
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,2 +1,2 @@ | ||
@import './colors'; | ||
@import './bg-colors'; | ||
@import './variables'; |
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,11 @@ | ||
body { | ||
@each $name, $map in $colors { | ||
@each $scale, $color in $map { | ||
@if $scale != '' { | ||
--tk-color-#{$name}-#{$scale}: #{$color}; | ||
} @else { | ||
--tk-color-#{$name}: #{$color}; | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
export default { | ||
title: 'Utils/Color\ Variables', | ||
}; | ||
|
||
const colors = [ | ||
'graphite', | ||
'midnight', | ||
'electricity', | ||
'green', | ||
'yellow', | ||
'red', | ||
]; | ||
|
||
const mainColors = [ | ||
'midnight', | ||
'electricity', | ||
'white', | ||
'orange', | ||
'lime', | ||
'plum', | ||
'rose', | ||
'black', | ||
]; | ||
|
||
const scales = ['05', '10', '20', '30', '40', '50', '60', '70', '80', '90']; | ||
|
||
export const ColorVariables = () => { | ||
return `<div> <h2>Main colors</h2> | ||
<p>Click to copy the variable to your clipboard</p> | ||
${mainColors.map((color) => { | ||
const hex = getHex(`--tk-color-${color}`); | ||
return `<div | ||
class="tk-card" | ||
style="background-color: var(--tk-color-${color}); cursor: pointer; max-width: 30rem;" | ||
onclick="navigator.clipboard.writeText('--tk-color-${color}')" | ||
> | ||
<div class="tk-m-1" style="display: flex; justify-content: space-between"> | ||
<span style="color: #000"> --tk-color-${color} ${hex}</span> <span style="color: #fff">--tk-color-${color} ${hex}</<span> | ||
</div> | ||
</div>`; | ||
}).join('<br/>')} | ||
${colors.map( | ||
(color) => | ||
`<div><h2>${color.toUpperCase()}</h2> | ||
<p>Click to copy the variable to your clipboard</p> | ||
${scales.map((scale) => { | ||
const hex = getHex(`--tk-color-${color}-${scale}`); | ||
return `<div | ||
class="tk-card" | ||
style="background-color: var(--tk-color-${color}-${scale}); cursor: pointer; max-width: 30rem;" | ||
onclick="navigator.clipboard.writeText('--tk-color-${color}-${scale}')" | ||
> | ||
<div class="tk-m-1" style="display: flex; justify-content: space-between"> | ||
<span style="color: #000"> --tk-color-${color}-${scale} ${hex}</span> <span style="color: #fff">--tk-color-${color}-${scale} ${hex}</<span> | ||
</div> | ||
</div>`; | ||
}).join('<br/>')} | ||
</div>` | ||
).join('<br/>')} | ||
</div>`; | ||
}; | ||
|
||
const getHex = (string) => | ||
getComputedStyle(document.querySelector('#root')).getPropertyValue(string); |
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,8 +1,8 @@ | ||
export default { | ||
title: 'Utils/Text', | ||
title: 'Utils/Label', | ||
}; | ||
|
||
export const Text = () => `<label class="tk-label">Default label</label> | ||
<label class="tk-label tk-label--error">Error label</label> | ||
<label class="tk-label tk-label--required">Required label</label> | ||
<label class="tk-label tk-label--disabled">Disabled label</label>`; | ||
export const Label = () => `<label class="tk-label">Default label .tk-label</label> | ||
<label class="tk-label tk-label--error">Error label .tk-label--error</label> | ||
<label class="tk-label tk-label--required">Required label .tk-label--required</label> | ||
<label class="tk-label tk-label--disabled">Disabled label .tk-label--disabled</label>`; |
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