Accessibility update
This commit is contained in:
1 parent
ba102fc9fc
commit
969cabb560
13 files changed
+237
-56
No files matched your search
@@ -4,16 +4,35 @@ export default function (app) {
|
|||||||
app.component('accessibilityControl', {
|
app.component('accessibilityControl', {
|
||||||
template,
|
template,
|
||||||
controller: ($scope, theme) => {
|
controller: ($scope, theme) => {
|
||||||
//const update = () => {
|
const themeSet = {
|
||||||
// $scope.isMainTheme = theme.currentTheme === theme.mainTheme
|
accessibility: 'accessibility',
|
||||||
//}
|
color: '',
|
||||||
//
|
fontSize: '',
|
||||||
//$scope.toggleTheme = () => {
|
fontFamily: '',
|
||||||
// theme.toggle()
|
}
|
||||||
// update()
|
|
||||||
//}
|
const install = () => {
|
||||||
//
|
const baked = Object
|
||||||
//update()
|
.values(themeSet)
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(' ')
|
||||||
|
theme.setTheme(baked)
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.setColorTheme = (color) => {
|
||||||
|
themeSet.color = color
|
||||||
|
install()
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.setFontTheme = (font) => {
|
||||||
|
themeSet.fontSize = font
|
||||||
|
install()
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.setFontFamilyTheme = (font) => {
|
||||||
|
themeSet.fontFamily = font
|
||||||
|
install()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,44 @@
|
|||||||
const themes = {
|
const defaultTheme = 'theme-default'
|
||||||
main: 'theme-default',
|
const defaultAccessibilityTheme = 'accessibility theme-accessibility-black-white'
|
||||||
accessibility: 'accessibility theme-accessibility-bw',
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultTheme = 'main'
|
const getTheme = () => localStorage.getItem('theme')
|
||||||
|
|
||||||
|
const isDefaultTheme = () => {
|
||||||
|
const theme = getTheme()
|
||||||
|
if (!theme) return true
|
||||||
|
return theme === defaultTheme
|
||||||
|
}
|
||||||
|
|
||||||
class Theme {
|
class Theme {
|
||||||
constructor($rootScope) {
|
constructor($rootScope) {
|
||||||
this.mainTheme = defaultTheme
|
this.mainTheme = defaultTheme
|
||||||
this.currentTheme = null
|
this.currentTheme = defaultAccessibilityTheme
|
||||||
|
|
||||||
const getTheme = value => themes[value]
|
|
||||||
const setTheme = value => {
|
|
||||||
const theme = value in themes ? value : defaultTheme
|
|
||||||
localStorage.setItem('theme', theme)
|
|
||||||
this.currentTheme = theme
|
|
||||||
$rootScope.theme = getTheme(theme)
|
|
||||||
}
|
|
||||||
|
|
||||||
setTheme(localStorage.getItem('theme'))
|
|
||||||
|
|
||||||
this.toggle = () => {
|
this.toggle = () => {
|
||||||
const t = this.currentTheme === 'main' ? 'accessibility' : 'main'
|
if (isDefaultTheme()) {
|
||||||
setTheme(t)
|
this.setTheme(this.currentTheme)
|
||||||
|
} else {
|
||||||
|
this.setMainTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setTheme = (themeName) => {
|
||||||
|
if (!themeName) {
|
||||||
|
this.setMainTheme()
|
||||||
|
} else {
|
||||||
|
localStorage.setItem('theme', themeName)
|
||||||
|
this.currentTheme = themeName
|
||||||
|
$rootScope.theme = themeName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setMainTheme = () => {
|
||||||
|
localStorage.removeItem('theme')
|
||||||
|
$rootScope.theme = this.mainTheme
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setTheme(getTheme())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (app) {
|
export default function (app) {
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
@import "../variables";
|
@import "../variables";
|
||||||
|
|
||||||
.accessibility-control{
|
.accessibility-control{
|
||||||
//display: none;
|
background-color: white;
|
||||||
|
|
||||||
background-color: gold;
|
|
||||||
height: 100px;
|
height: 100px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
ul li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,28 +16,8 @@ body {
|
|||||||
h2{
|
h2{
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: $single-margin;
|
margin-bottom: $single-margin;
|
||||||
|
|
||||||
//background-color: hsl(0, 0, 95%);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2{
|
|
||||||
font-family: $title-font;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h3{
|
h3{
|
||||||
margin-bottom: $single-margin / 2;
|
margin-bottom: $single-margin / 2;
|
||||||
|
|
||||||
//a {
|
|
||||||
// color: $dark-color;
|
|
||||||
// text-decoration: none;
|
|
||||||
// border-bottom: 1px solid lighten($dark-color, 10%);
|
|
||||||
//
|
|
||||||
// &:hover {
|
|
||||||
// border-bottom: 1px solid lighten($dark-color, 25%);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// &:active {
|
|
||||||
// border-bottom: 1px solid $dark-color;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
@@ -42,4 +42,9 @@
|
|||||||
// THEMES
|
// THEMES
|
||||||
|
|
||||||
@import "themes/theme-default";
|
@import "themes/theme-default";
|
||||||
@import "themes/theme-accessibility-bw";
|
@import "themes/theme-accessibility-black-white";
|
||||||
|
@import "themes/theme-accessibility-white-black";
|
||||||
|
@import "themes/theme-accessibility-font-big";
|
||||||
|
@import "themes/theme-accessibility-font-biggest";
|
||||||
|
@import "themes/theme-accessibility-font-sans";
|
||||||
|
@import "themes/theme-accessibility-font-serif";
|
||||||
+1
-3
@@ -1,6 +1,6 @@
|
|||||||
@import "../variables";
|
@import "../variables";
|
||||||
|
|
||||||
.theme-accessibility-bw {
|
.theme-accessibility-black-white {
|
||||||
background-color: $darker-color;
|
background-color: $darker-color;
|
||||||
color: $lighter-color;
|
color: $lighter-color;
|
||||||
|
|
||||||
@@ -23,9 +23,7 @@
|
|||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.main-menu {
|
|
||||||
.selected {
|
.selected {
|
||||||
border-top: $menu-colored-mark-thickness solid $dark-color;
|
border-top: $menu-colored-mark-thickness solid $dark-color;
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
@import "../variables";
|
||||||
|
|
||||||
|
.theme-accessibility-font-big {
|
||||||
|
font-size: 18pt;
|
||||||
|
|
||||||
|
.main-menu {
|
||||||
|
font-size: $bigger-font-size;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
font-size: $bigger-font-size;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
@import "../variables";
|
||||||
|
|
||||||
|
.theme-accessibility-font-biggest {
|
||||||
|
font-size: 24pt;
|
||||||
|
|
||||||
|
.main-menu {
|
||||||
|
font-size: $bigger-font-size;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
font-size: $bigger-font-size;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@import "../variables";
|
||||||
|
|
||||||
|
.theme-accessibility-font-sans {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@import "../variables";
|
||||||
|
|
||||||
|
.theme-accessibility-font-serif {
|
||||||
|
font-family: serif;
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
@import "../variables";
|
||||||
|
|
||||||
|
.theme-accessibility-white-black {
|
||||||
|
background-color: $lighter-color;
|
||||||
|
color: $darker-color;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $darker-color;
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: 1px solid $darker-color;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-menu {
|
||||||
|
a {
|
||||||
|
color: $darker-color;
|
||||||
|
border-bottom: 1px solid $darker-color;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
border-top: $menu-colored-mark-thickness solid $darker-color;
|
||||||
|
|
||||||
|
a:link, a:visited {
|
||||||
|
color: $darker-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
&.content--padding-top--menu {
|
||||||
|
padding-top: $menu-thickness + $double-margin + 5em;
|
||||||
|
padding-bottom: $single-margin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation {
|
||||||
|
background-color: $lighter-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.parallax {
|
||||||
|
&__end {
|
||||||
|
background-color: $lighter-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.article {
|
||||||
|
&__head {
|
||||||
|
.date {
|
||||||
|
color: $darker-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
color: $darker-color;
|
||||||
|
background-color: $lighter-color;
|
||||||
|
|
||||||
|
font-size: $normal-font-size;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
@import "../variables";
|
@import "../variables";
|
||||||
|
|
||||||
.theme-default {
|
.theme-default {
|
||||||
|
h1, h2{
|
||||||
|
font-family: $title-font;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $dark-color;
|
color: $dark-color;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,58 @@
|
|||||||
<div class="accessibility-control">
|
<div class="accessibility-control">
|
||||||
<button>Let's rock!</button>
|
<ul>
|
||||||
|
<li>
|
||||||
|
<button ng-click="setColorTheme('theme-accessibility-black-white')"
|
||||||
|
>Белым по черному
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button ng-click="setColorTheme('theme-accessibility-white-black')"
|
||||||
|
>Черным по белому
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<!--<li>-->
|
||||||
|
<!--<button ng-click="setTheme('dark-blue')"-->
|
||||||
|
<!-->Темно-синим по голубому-->
|
||||||
|
<!--</button>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--<li>-->
|
||||||
|
<!--<button ng-click="setTheme('brown')"-->
|
||||||
|
<!-->Коричневым по бежевому</button>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--<li>-->
|
||||||
|
<!--<button ng-click="setTheme('green')"-->
|
||||||
|
<!-->Зеленым по темно-коричневому</button>-->
|
||||||
|
<!--</li>-->
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<button ng-click="setFontTheme('')"
|
||||||
|
>Нормально
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button ng-click="setFontTheme('theme-accessibility-font-big')"
|
||||||
|
>Большие
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button ng-click="setFontTheme('theme-accessibility-font-biggest')"
|
||||||
|
>Огромные
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<button ng-click="setFontFamilyTheme('theme-accessibility-font-sans')"
|
||||||
|
>Без засечек
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button ng-click="setFontFamilyTheme('theme-accessibility-font-serif')"
|
||||||
|
>С засечками
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user