Skip to content

Commit 02de0dc

Browse files
fixed value preview
1 parent b596683 commit 02de0dc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/plugins/global-settings/typography/typography-picker.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import {
66
createTypographyStyles, getFontFamilyLabel, loadGoogleFont,
77
} from '~stackable/util'
88
import { i18n } from 'stackable'
9-
import { upperFirst, omit } from 'lodash'
9+
import {
10+
upperFirst, omit, startCase, last,
11+
} from 'lodash'
1012
import classnames from 'classnames'
1113
import { generateStyles } from '~stackable/block-components'
1214
import { usePresetControls } from '~stackable/hooks'
@@ -165,7 +167,14 @@ const createDescription = ( styleObject, device = 'desktop' ) => {
165167
description.push( upperFirst( styleObject.textTransform ) )
166168
}
167169

168-
return description.join( ', ' )
170+
// If a css custom property, get just the name names
171+
return description.map( value => {
172+
if ( value.includes( 'var(' ) ) {
173+
const propName = value.match( /var\(([^\),]*)/ )?.[ 1 ]
174+
return startCase( last( propName.split( '--' ) ) )
175+
}
176+
return value
177+
} ).join( ', ' )
169178
}
170179

171180
const TypographyPreview = props => {

0 commit comments

Comments
 (0)