1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-26 23:56:59 +03:00

Adds color names sample to the website lab

This commit is contained in:
Rasmus Andersson 2017-09-29 09:08:56 -07:00
parent 05bfd6acf8
commit 6daae9e591
2 changed files with 25 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -320,6 +320,30 @@ samples.set('Symbols', `
\uE004 White Component instance (private-area, U+E004) \uE004 White Component instance (private-area, U+E004)
`) `)
samples.set('Color names', {
_cachedHTML: null,
_isFetching: false,
toHTML() {
if (this._cachedHTML) {
return this._cachedHTML
}
fetch('color-names.json').then(r => r.json()).then(names => {
if (!this._cachedHTML) {
let namestr = names.join('\n')
let r = document.createElement('div')
r.innerText = namestr
this._cachedHTML = r.innerHTML
}
if (sampleVar) {
sampleVar.refreshValue(null)
}
})
return 'fetching color names...'
},
})
samples.set('────── body ──────', null) samples.set('────── body ──────', null)
samples.set('Body text 1', ` samples.set('Body text 1', `