|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
634 bytes
|
| Line | |
|---|
| 1 | import escapeClassName from './escapeClassName'
|
|---|
| 2 | import escapeCommas from './escapeCommas'
|
|---|
| 3 |
|
|---|
| 4 | export function asClass(name) {
|
|---|
| 5 | return escapeCommas(`.${escapeClassName(name)}`)
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | export default function nameClass(classPrefix, key) {
|
|---|
| 9 | return asClass(formatClass(classPrefix, key))
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | export function formatClass(classPrefix, key) {
|
|---|
| 13 | if (key === 'DEFAULT') {
|
|---|
| 14 | return classPrefix
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | if (key === '-' || key === '-DEFAULT') {
|
|---|
| 18 | return `-${classPrefix}`
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | if (key.startsWith('-')) {
|
|---|
| 22 | return `-${classPrefix}${key}`
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | if (key.startsWith('/')) {
|
|---|
| 26 | return `${classPrefix}${key}`
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | return `${classPrefix}-${key}`
|
|---|
| 30 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.