git ssb

16+

Dominic / patchbay



Commit a035e0e448371bb320700598868f4917a757c12b

add dyslexia fonts toggle to /settings

mixmix committed on 6/7/2019, 8:43:01 AM
Parent: a90e479d4bb512807a6f0fc73713b8a205c849a1

Files changed

app/html/settings/accessibility.jschanged
app/html/settings/custom-styles.mcsschanged
app/html/settings/dyslexia-fonts.jsadded
app/page/settings.mcsschanged
app/sync/initialise/styles.jschanged
app/html/settings/accessibility.jsView
@@ -20,9 +20,10 @@
2020 const brightness = api.settings.obs.get('patchbay.accessibility.brightness')
2121 const contrast = api.settings.obs.get('patchbay.accessibility.contrast')
2222
2323 return {
24- title: 'Accessibility',
24 + group: 'accessibility',
25 + title: 'Accessibility Styles',
2526 body: h('AccessibilityStyles', [
2627 h('div', { 'ev-click': () => invert.set(!invert()) }, [
2728 h('label', 'Invert colors'),
2829 h('i.fa', { className: when(invert, 'fa-check-square', 'fa-square-o') })
app/html/settings/custom-styles.mcssView
@@ -1,9 +1,13 @@
11 CustomStyles {
22 textarea {
33 font-family: monospace
44 line-height: 1.2rem
5 + max-width: calc(100% - 1rem)
6 + min-height: 400px
7 + border: 1px solid gainsboro
58 }
9 +
610 button {
711 display: block
812 margin: .5rem 0
913 }
app/html/settings/dyslexia-fonts.jsView
@@ -1,0 +1,31 @@
1 +const nest = require('depnest')
2 +const { h, when } = require('mutant')
3 +
4 +exports.gives = nest({
5 + 'app.html.settings': true
6 +})
7 +
8 +exports.needs = nest({
9 + 'settings.obs.get': 'first'
10 +})
11 +
12 +exports.create = function (api) {
13 + return nest({
14 + 'app.html.settings': accessibility
15 + })
16 +
17 + function accessibility () {
18 + const font = api.settings.obs.get('patchbay.accessibility.openDyslexicEnabled', false)
19 +
20 + return {
21 + group: 'accessibility',
22 + title: 'Dyslexia Fonts',
23 + body: h('AccessibilityStyles', [
24 + h('div', { 'ev-click': () => font.set(!font()) }, [
25 + h('label', 'Enable OpenDyslexic font'),
26 + h('i.fa', { className: when(font, 'fa-check-square', 'fa-square-o') })
27 + ])
28 + ])
29 + }
30 + }
31 +}
app/page/settings.mcssView
@@ -51,16 +51,8 @@
5151 margin-top: .2rem
5252 margin-left: .3rem
5353 }
5454
55- textarea {
56- min-width: 400px
57- width: 600px
58- max-width: 600px
59- min-height: 200px
60- border: 1px solid gainsboro
61- }
62-
6355 input {
6456 font-size: 1rem
6557
6658 padding: .5rem
app/sync/initialise/styles.jsView
@@ -1,7 +1,7 @@
11 const nest = require('depnest')
22 const compileCss = require('micro-css')
3-const { h, computed } = require('mutant')
3 +const { h, computed, when } = require('mutant')
44 const get = require('lodash/get')
55
66 exports.gives = nest('app.sync.initialise')
77
@@ -16,8 +16,9 @@
1616 function styles () {
1717 const css = values(api.styles.css()).join('\n')
1818 const custom = api.settings.obs.get('patchbay.customStyles')
1919 const accessibility = api.settings.obs.get('patchbay.accessibility')
20 + const openDyslexicEnabled = api.settings.obs.get('patchbay.accessibility.openDyslexicEnabled')
2021
2122 document.head.appendChild(
2223 h('style', { innerHTML: css })
2324 )
@@ -31,8 +32,13 @@
3132 return compileCss(accessibilityMcss(a11y))
3233 })
3334 })
3435 )
36 + document.head.appendChild(
37 + h('style', {
38 + innerHTML: when(openDyslexicEnabled, '.App { font-family: OpenDyslexicRegular; }', '')
39 + })
40 + )
3541 }
3642 }
3743
3844 // ////////////////////////////

Built with git-ssb-web