Skip to content

Commit

Permalink
feat(admin-ui): Enable theming by use of css custom properties
Browse files Browse the repository at this point in the history
Relates to #391
  • Loading branch information
michaelbromley committed Jan 7, 2021
1 parent 165cac3 commit 68107d2
Show file tree
Hide file tree
Showing 110 changed files with 920 additions and 316 deletions.
8 changes: 4 additions & 4 deletions packages/admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"@angular/router": "10.1.4",
"@apollo/client": "^3.0.0",
"@biesbjerg/ngx-translate-extract-marker": "^1.0.0",
"@clr/angular": "^4.0.3",
"@clr/core": "^4.0.3",
"@clr/icons": "^4.0.3",
"@clr/ui": "^4.0.3",
"@clr/angular": "^4.0.8",
"@clr/core": "^4.0.8",
"@clr/icons": "^4.0.8",
"@clr/ui": "^4.0.8",
"@ng-select/ng-select": "^5.0.3",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/admin-ui/scripts/compile-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const sass = require('sass');
// non-Angular ui extensions.
const outFile = path.join(__dirname, '../package/static/theme.min.css');
const result = sass.renderSync({
file: path.join(__dirname, '../src/lib/static/styles/theme.scss'),
file: path.join(__dirname, '../src/lib/static/styles/ui-extension-theme.scss'),
importer,
includePaths: [path.join(__dirname, '../src/lib/static/styles')],
outputStyle: 'compressed',
Expand All @@ -15,7 +15,6 @@ const result = sass.renderSync({

fs.writeFileSync(outFile, result.css, 'utf8');


function importer(url, prev, done) {
let file = url;
// Handle the imports prefixed with ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name="searchTerm"
[formControl]="searchTerm"
[placeholder]="'asset.search-asset-name' | translate"
class="search-input"
class="search-input ml3"
/>
</vdr-ab-left>
<vdr-ab-right>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

:host {
display: flex;
Expand All @@ -12,7 +11,7 @@ vdr-asset-gallery {

.paging-controls {
padding-top: 6px;
border-top: 1px solid var(--color-grey-200);
border-top: 1px solid var(--color-component-border-100);
display: flex;
justify-content: space-between;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

vdr-channel-assignment-control {
min-width: 200px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
@import "variables";

.contents-header {
background-color: var(--color-grey-100);
background-color: var(--color-component-bg-100);
position: sticky;
top: 0;
padding: 6px;
z-index: 1;
border-bottom: 1px solid var(--color-grey-300);
border-bottom: 1px solid var(--color-component-border-200);

.header-title-row {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<vdr-action-bar>
<vdr-ab-left>
<clr-checkbox-wrapper class="expand-all-toggle">
<clr-checkbox-wrapper class="expand-all-toggle ml3">
<input type="checkbox" clrCheckbox [(ngModel)]="expandAll" />
<label>{{ 'catalog.expand-all-collections' | translate }}</label>
</clr-checkbox-wrapper>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

:host {
height: 100%;
Expand Down Expand Up @@ -48,7 +47,7 @@

.paging-controls {
padding-top: 6px;
border-top: 1px solid var(--color-grey-200);
border-top: 1px solid var(--color-component-border-100);
display: flex;
justify-content: space-between;
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
@import "variables";

:host {
display: block;
}
.collection {
background-color: white;
background-color: var(--color-component-bg-100);
font-size: 0.65rem;
color: rgba(0, 0, 0, 0.87);
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
margin-bottom: 2px;
border-left: 2px solid transparent;
transition: border-left-color 0.2s;

&.private {
background-color: var(--color-grey-200);
background-color: var(--color-component-bg-200);
}

.collection-detail {
padding: 6px 12px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid var(--color-grey-200);
border-bottom: 1px solid var(--color-component-border-100);

&.active {
background-color: var(--color-grey-200);
background-color: var(--clr-global-selection-color);
}

&.depth-1 { padding-left: 12px + 24px; }
Expand All @@ -41,7 +39,7 @@

.tree-node {
display: block;
background: white;
background: var(--color-component-bg-100);
overflow: hidden;
&.cdk-drop-list-dragging {
> .collection {
Expand All @@ -52,7 +50,7 @@

.drag-placeholder {
min-height: 120px;
background-color: var(--color-grey-300);
background-color: var(--color-component-bg-300);
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

.visible-toggle {
margin-top: -3px !important;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import "variables";

td {
&.private {
background-color: var(--color-grey-200);
background-color: var(--color-component-bg-200);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

:host {
display: block;
Expand All @@ -21,7 +20,7 @@
.variants-preview {
tr.disabled {
td {
background-color: var(--color-grey-100);
background-color: var(--color-component-bg-100);
color: var(--color-grey-400);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

.input-wrapper {
background-color: white;
Expand All @@ -25,7 +24,7 @@
outline: none;
}
&:disabled {
background-color: var(--color-grey-100);
background-color: var(--color-component-bg-100);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

:host {
width: 340px;
Expand All @@ -15,7 +14,7 @@

.featured-asset {
text-align: center;
background: var(--color-grey-200);
background: var(--color-component-bg-200);
padding: 6px;
cursor: pointer;

Expand All @@ -42,7 +41,7 @@
.asset-thumb {
margin: 3px;
padding: 0;
border: 2px solid var(--color-grey-200);
border: 2px solid var(--color-component-border-100);
cursor: pointer;

&.featured {
Expand All @@ -67,7 +66,7 @@
align-items: center;
justify-content: center;
width: 50px;
background-color: var(--color-grey-100);
background-color: var(--color-component-bg-100);
opacity: 0.9;
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
0 8px 10px 1px rgba(0, 0, 0, 0.14),
Expand All @@ -79,7 +78,7 @@
width: 60px;
height: 50px;
.asset-thumb {
background-color: var(--color-grey-300);
background-color: var(--color-component-bg-300);
height: 100%;
width: 54px;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

:host {
::ng-deep {
Expand All @@ -21,7 +20,8 @@ vdr-action-bar clr-toggle-wrapper {
border-radius: 3px 0 0 3px !important;
}
.icon-button {
border: 1px solid var(--color-grey-300);
border: 1px solid var(--color-component-border-300);
background-color: var(--color-component-bg-100);
border-radius: 0 3px 3px 0;
border-left: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(searchTermChange)="setSearchTerm($event)"
(facetValueChange)="setFacetValueIds($event)"
></vdr-product-search-input>
<vdr-dropdown class="search-settings-menu">
<vdr-dropdown class="search-settings-menu mr3">
<button type="button" class="icon-button" vdrDropdownTrigger>
<clr-icon shape="cog"></clr-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.image-placeholder {
width: 50px;
height: 50px;
background-color: var(--color-grey-200);
background-color: var(--color-component-bg-200);
.placeholder {
text-align: center;
color: var(--color-grey-300);
Expand All @@ -25,5 +25,5 @@
margin: 0 12px;
}
td.disabled {
background-color: var(--color-grey-200);
background-color: var(--color-component-bg-200);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";
@import "mixins";

:host {
Expand All @@ -19,10 +18,10 @@ ng-select {

.search-header {
padding: 8px 10px;
border-bottom: 1px solid var(--color-grey-200);
border-bottom: 1px solid var(--color-component-border-100);
cursor: pointer;

&.selected, &:hover {
background-color: var(--color-grey-200);
background-color: var(--color-component-bg-200);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

.option-groups {
display: flex;
Expand All @@ -15,7 +14,7 @@
.variants-preview {
tr.disabled {
td {
background-color: var(--color-grey-100);
background-color: var(--color-component-bg-100);
color: var(--color-grey-400);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
display: flex;
min-height: 52px;
align-items: center;
border: 1px solid var(--color-grey-200);
border: 1px solid var(--color-component-border-100);
border-radius: 3px;
padding: 6px 18px;

Expand All @@ -21,7 +21,7 @@
transition: background-color 0.2s;
min-height: 330px;
&.disabled {
background-color: var(--color-grey-200);
background-color: var(--color-component-bg-200);
}
.header-row {
display: flex;
Expand Down Expand Up @@ -118,7 +118,7 @@
}

.option-group-name {
color: var(--color-grey-400);
color: var(--color-text-200);
text-transform: uppercase;
font-size: 10px;
margin-right: 3px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

.placeholder {
color: var(--color-grey-300);
Expand All @@ -13,6 +12,6 @@
td {
transition: background-color 0.2s;
&.disabled {
background-color: var(--color-grey-200);
background-color: var(--color-component-bg-200);
}
}
1 change: 0 additions & 1 deletion packages/admin-ui/src/lib/core/src/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";
.progress {
position: absolute;
overflow: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,22 @@
*/
export function stringToColor(input: string): string {
if (!input || input === '') {
return '#fff';
return 'var(--color-component-bg-100)';
}
const safeColors = [
// '#FF4343',
// '#9A0089',
// '#881798',
'#10893E',
'#107C10',
'#7E735F',
'#2F5646',
// '#D13438',
// '#C239B3',
// '#B146C2',
'#498205',
'#847545',
// '#EF6950',
// '#BF0077',
'#744DA9',
'#018574',
'#486860',
'#525E54',
'#647C64',
'#567C73',
// '#DA3B01',
'#8764B8',
// '#C30052',
'#515C6B',
'#4A5459',
'#69797E',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

:host {
display: block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "variables";

:host {
display: flex;
Expand Down
Loading

0 comments on commit 68107d2

Please sign in to comment.