Skip to content

Commit

Permalink
Add Corteza studio UI personalization feature
Browse files Browse the repository at this point in the history
  • Loading branch information
KinyaElGrande committed Oct 6, 2023
1 parent 38580e5 commit 3e3e595
Show file tree
Hide file tree
Showing 214 changed files with 22,193 additions and 3,545 deletions.
6 changes: 3 additions & 3 deletions client/web/admin/src/components/Apigw/CFiltersStepper.vue
Expand Up @@ -206,14 +206,14 @@ export default {
.apigw {
.nav-link {
color: $primary;
color: var(--primary);
border-width: 0 0 3px 0 !important;
border-color: transparent !important;
}
.active-tab {
color: $primary !important;
border-color: $primary !important;
color: var(--primary) !important;
border-color: var(--primary) !important;
}
}
</style>
2 changes: 1 addition & 1 deletion client/web/admin/src/components/CRolePicker.vue
Expand Up @@ -156,7 +156,7 @@ export default {
.filtered-role {
cursor: pointer;
&:hover {
background-color: $light;
background-color: var(--light);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/web/admin/src/components/ConfirmationToggle.vue
Expand Up @@ -67,11 +67,11 @@ export default {
}
.btn-url {
color: $danger;
color: var(--danger);
text-decoration: none;
&:hover {
color: $danger;
color: var(--danger);
.icon-trash {
font-weight: 900;
Expand Down
Expand Up @@ -506,22 +506,22 @@ export default {
cursor: not-allowed;
}
.active-cell:hover {
background-color: $gray-200;
background-color: var(--gray-200);
}
.rotate {
transform: rotate(45deg);
}
.hide-role:hover {
.rotate {
color: $dark !important;
color: var(--dark) !important;
}
}
</style>

<style lang="scss">
.mode {
.btn {
background-color: $light;
background-color: var(--light);
border: none;
}
Expand Down
180 changes: 180 additions & 0 deletions client/web/admin/src/components/Settings/UI/CUIBrandingEditor.vue
@@ -0,0 +1,180 @@
<template>
<b-card
class="shadow-sm"
header-bg-variant="white"
footer-bg-variant="white"
>
<template #header>
<h3 class="m-0">
{{ $t('title') }}
</h3>
</template>

<div class="row row-cols-2 mx-2">
<div
v-for="(colorInfo, key) in colorData"
:key="key"
class="p-2 border"
>
<label
:for="key"
class="text-primary"
>{{ colorInfo.label }}</label>
<div class="form-group row">
<c-input-color-picker
v-model="colorInfo.value"
:data-test-id="`input-${key}-color`"
width="24px"
height="24px"
:show-color-code-text="true"
class="px-3"
:translations="colorTranslations"
/>
</div>
</div>
</div>

<template #footer>
<c-submit-button
:disabled="!canManage"
:processing="processing"
:success="success"
class="float-right mt-2"
@submit="onSubmit"
/>
</template>
</b-card>
</template>

<script>
import CSubmitButton from 'corteza-webapp-admin/src/components/CSubmitButton'
import { components } from '@cortezaproject/corteza-vue'
const { CInputColorPicker } = components
export default {
name: 'CUIBrandingEditor',
i18nOptions: {
namespaces: 'ui.settings',
keyPrefix: 'editor.corteza-studio',
},
components: {
CInputColorPicker,
CSubmitButton,
},
props: {
settings: {
type: Object,
required: true,
},
processing: {
type: Boolean,
value: false,
},
success: {
type: Boolean,
value: false,
},
canManage: {
type: Boolean,
required: true,
},
},
data () {
return {
colorData: {
white: {
label: 'White',
value: '#FFFFFF',
},
black: {
label: 'Black',
value: '#162425',
},
primary: {
label: 'Primary',
value: '#0B344E',
},
secondary: {
label: 'Secondary',
value: '#758D9B',
},
success: {
label: 'Success',
value: '#43AA8B',
},
warning: {
label: 'Warning',
value: '#E2A046',
},
danger: {
label: 'Danger',
value: '#E54122',
},
light: {
label: 'Light',
value: '#E4E9EF',
},
extraLight: {
label: 'Extra Light',
value: '#F3F5F7',
},
dark: {
label: 'Dark',
value: '#162425',
},
tertiary: {
label: 'Tertiary',
value: '#5E727E',
},
gray200: {
label: 'Gray-200',
value: '#F9FAFB ',
},
bodyBg: {
label: 'Body Background',
value: '#F9FAFB',
},
},
colorTranslations: {
modalTitle: this.$t('colorPicker'),
saveBtnLabel: this.$t('general:label.saveAndClose'),
},
}
},
watch: {
settings: {
immediate: true,
handler (settings) {
const brandingVariables = settings['ui.branding.variables'] || []
if (brandingVariables.length !== 0) {
this.colorData.primary.value = this.brandColorValue(brandingVariables, 'primary')
this.colorData.secondary.value = this.brandColorValue(brandingVariables, 'secondary')
}
},
},
},
methods: {
onSubmit () {
const brandVariables = Object.keys(this.colorData).map(key => {
return `$${key}: ${this.colorData[key].value}`
})
this.$emit('submit', { 'ui.branding.variables': brandVariables })
},
brandColorValue (brandingVariables, variable) {
const brandingVariable = brandingVariables.find(item => item.includes(`$${variable}:`))
return brandingVariable.split(':')[1]
},
},
}
</script>
Expand Up @@ -35,7 +35,7 @@
>
<c-ace-editor
v-model="modalCSSInput"
lang="css"
lang="scss"
height="500px"
font-size="14px"
show-line-numbers
Expand Down
20 changes: 10 additions & 10 deletions client/web/admin/src/themes/corteza-base/custom.scss
Expand Up @@ -10,7 +10,7 @@ body {
}

:focus {
outline-color: $primary;
outline-color: var(--primary);
}

button:disabled {
Expand All @@ -36,13 +36,13 @@ thead th,
legend,
label,
.btn {
font-family: $font-medium;
font-family: var(--font-medium);
}

strong,
b,
.font-weight-bold {
font-family: $font-semibold;
font-family: var(--font-semibold);
}

th {
Expand Down Expand Up @@ -81,7 +81,7 @@ th {
padding: 0.375rem;
padding-top: 0;
border-width: 2px;
border-color: $light;
border-color: var(--light);

.vs__selected {
margin-top: 0.375rem;
Expand All @@ -94,7 +94,7 @@ th {

.vs__clear,
.vs__open-indicator {
fill: $gray-900;
fill: var(--gray-900);
display: inline-flex;
}
}
Expand All @@ -104,7 +104,7 @@ th {
}

.loader {
height: calc(100vh - 2 * #{$topbar-height});
height: calc(100vh - 2 * #{var(--topbar-height)});
display: flex;
align-items: center;
justify-content: space-around;
Expand Down Expand Up @@ -135,14 +135,14 @@ th {
fieldset.required {
&.error {
legend::before {
color: $danger;
color: var(--danger);
}
}

label::after {
content: "*";
display: inline-block;
color: $danger;
color: var(--danger);
width: 10px;
height: 18px;
overflow: hidden;
Expand All @@ -156,7 +156,7 @@ fieldset.required {

.alert {
z-index: 1040;
box-shadow: 0 0 2px 0 rgba($secondary, 0.75);
box-shadow: 0 0 2px 0 rgba(var(--secondary), 0.75);
}
}

Expand All @@ -183,7 +183,7 @@ input[type="search"]::-webkit-search-cancel-button {
}

.bg-extra-light {
background-color: $extra-light;
background-color: var(--extra-light);
}

@keyframes ellipsis {
Expand Down
5 changes: 1 addition & 4 deletions client/web/admin/src/themes/corteza-base/index.scss
@@ -1,7 +1,4 @@
@import "./rtl.scss";
@import "~vue-select/dist/vue-select.css";
@import "variables.scss";
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/src/index.scss';
@import "custom";
@import "./poppins.scss";
@import "./poppins.scss";
3 changes: 3 additions & 0 deletions client/web/admin/src/themes/corteza-base/poppins.scss
@@ -1,3 +1,6 @@
// Fonts Path
$fonts_dir : './fonts/' !default;

@font-face {
font-family: 'Poppins-Bold';
src: url($fonts_dir + 'poppins/Poppins-Bold.ttf') format('truetype');
Expand Down
2 changes: 1 addition & 1 deletion client/web/admin/src/themes/corteza-base/rtl.scss
@@ -1,6 +1,6 @@
[dir] {
margin: 0;
background-color: $body-bg;
background-color: var(--body-bg);
}

[dir="rtl"] {
Expand Down

0 comments on commit 3e3e595

Please sign in to comment.