mirror of https://github.com/Requarks/wiki.git
NGPixel
7 years ago
committed by
Nicolas Giard
9 changed files with 161 additions and 11 deletions
Split View
Diff Options
-
2CHANGELOG.md
-
2client/js/app.js
-
32client/js/components/color-picker.vue
-
21client/js/components/toggle.vue
-
2client/scss/app.scss
-
32client/scss/components/color-picker.scss
-
53client/scss/components/toggle.scss
-
6server/locales/en/admin.json
-
22server/views/pages/admin/theme.pug
@ -1,14 +1,40 @@ |
|||
<template lang="pug"> |
|||
p.control |
|||
input.input(type='text', placeholder='#F0F0F0', v-model='color') |
|||
.colorpicker |
|||
.colorpicker-choice(v-for='color in colors', :class='["is-" + color, color === currentColor ? "is-active" : ""]', @click='setColor(color)') |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'color-picker', |
|||
props: ['currentColor'], |
|||
data () { |
|||
return { |
|||
color: '000000' |
|||
colors: [ |
|||
'red', |
|||
'pink', |
|||
'purple', |
|||
'deep-purple', |
|||
'indigo', |
|||
'blue', |
|||
'light-blue', |
|||
'cyan', |
|||
'teal', |
|||
'green', |
|||
'light-green', |
|||
'lime', |
|||
'yellow', |
|||
'amber', |
|||
'orange', |
|||
'deep-orange', |
|||
'brown', |
|||
'grey', |
|||
'blue-grey' |
|||
] |
|||
} |
|||
}, |
|||
methods: { |
|||
setColor(color) { |
|||
this.currentColor = color |
|||
} |
|||
} |
|||
} |
|||
|
@ -0,0 +1,21 @@ |
|||
<template lang="pug"> |
|||
.toggle(:class='{ "is-active": currentValue }', @click='changeToggle') |
|||
.toggle-container |
|||
.toggle-pin |
|||
.toggle-text {{ desc }} |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'toggle', |
|||
props: ['currentValue', 'desc'], |
|||
data () { |
|||
return { } |
|||
}, |
|||
methods: { |
|||
changeToggle() { |
|||
this.currentValue = !this.currentValue |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,32 @@ |
|||
.colorpicker { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 60px; |
|||
|
|||
&-choice { |
|||
width: 50px; |
|||
height: 50px; |
|||
border: 1px solid #FFF; |
|||
transition: all .2s ease; |
|||
cursor: pointer; |
|||
|
|||
&.is-active, &:hover { |
|||
border-width: 5px; |
|||
width: 60px; |
|||
height: 60px; |
|||
} |
|||
|
|||
@each $color, $colorvalue in $material-colors { |
|||
&.is-#{$color} { |
|||
background-color: mc($color, '500'); |
|||
border-color: mc($color,'500'); |
|||
|
|||
&.is-active, &:hover { |
|||
border-color: mc($color,'300'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
.toggle { |
|||
display: inline-flex; |
|||
align-items: center; |
|||
height: 24px; |
|||
cursor: pointer; |
|||
margin: 5px 5px 5px 0; |
|||
|
|||
& + & { |
|||
margin-left: 15px; |
|||
} |
|||
|
|||
&-container { |
|||
display: inline-flex; |
|||
align-items: center; |
|||
height: 24px; |
|||
width: 50px; |
|||
background-color: mc('grey', '300'); |
|||
border-radius: 12px; |
|||
padding: 2px; |
|||
transition: background-color .5s ease; |
|||
} |
|||
|
|||
&-pin { |
|||
display: flex; |
|||
background-color: #FFF; |
|||
border-radius:10px; |
|||
height: 20px; |
|||
width: 20px; |
|||
transition: all .5s ease; |
|||
} |
|||
|
|||
&-text { |
|||
padding-left: 10px; |
|||
color: mc('grey', '700'); |
|||
font-size: 12px; |
|||
} |
|||
|
|||
&:hover { |
|||
.toggle-container { |
|||
background-color: mc('grey', '400'); |
|||
} |
|||
} |
|||
|
|||
&.is-active { |
|||
.toggle-container { |
|||
background-color: mc('indigo', '500'); |
|||
} |
|||
.toggle-pin { |
|||
margin-left: 28px; |
|||
} |
|||
} |
|||
|
|||
} |
@ -1,11 +1,17 @@ |
|||
extends ./_layout.pug |
|||
|
|||
block adminContent |
|||
#page-type-admin-settings |
|||
.hero |
|||
h1.title#title= t('nav.theme') |
|||
h2.subtitle= t('admin:theme.subtitle') |
|||
.form-sections |
|||
section |
|||
label.label= t('admin:theme.primarycolor') |
|||
color-picker |
|||
.hero |
|||
h1.title#title= t('nav.theme') |
|||
h2.subtitle= t('admin:theme.subtitle') |
|||
.form-sections |
|||
section |
|||
label.label= t('admin:theme.primarycolor') |
|||
color-picker(current-color='indigo') |
|||
section |
|||
label.label= t('admin:theme.altcolor') |
|||
color-picker(current-color='blue-grey') |
|||
section |
|||
label.label= t('admin:theme.codeblock') |
|||
toggle(current-value='dark', desc='Use Dark Theme') |
|||
toggle(current-value='dark', desc='Colorize code syntax') |
Write
Preview
Loading…
Cancel
Save