Adds color names sample to the website lab
This commit is contained in:
parent
05bfd6acf8
commit
6daae9e591
2 changed files with 25 additions and 0 deletions
1
docs/lab/color-names.json
Normal file
1
docs/lab/color-names.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -320,6 +320,30 @@ samples.set('Symbols', `
|
|||
\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 text 1', `
|
||||
|
|
|
|||
Reference in a new issue