Skip to content

Commit

Permalink
Fix pascal case bug
Browse files Browse the repository at this point in the history
  • Loading branch information
johno committed May 4, 2022
1 parent c1120fe commit 81cfd40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-sheep-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@compai/css-gui': patch
---

Fix pascal case bug
12 changes: 6 additions & 6 deletions packages/gui/src/lib/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EditorProps } from '../types/editor'
import { isPseudoClass, isPseudoElement } from './pseudos'
import { isElement } from './elements'
import { camelCase, lowerCase, startCase, upperFirst } from 'lodash-es'
import { lowerCase, startCase, upperFirst } from 'lodash-es'

export type EditorPropsWithLabel<T> = EditorProps<T> & { label: string }
/**
Expand Down Expand Up @@ -96,13 +96,13 @@ export const toGoogleFontUrl = (families: FontFamilyData[]) => {
*/
export const toGoogleVariableFontUrl = (variableFonts: any[]) => {
if (!variableFonts?.length) return null

let familyQueries: any[] = []

variableFonts.forEach((vFont) => {
let prependQuery = `family=${plusify(vFont.name)}:`
delete vFont['name']

let orderedKeys = [
...Object.keys(vFont)
.filter((k) => k === k.toLowerCase())
Expand All @@ -111,9 +111,9 @@ export const toGoogleVariableFontUrl = (variableFonts: any[]) => {
.filter((k) => k === k.toUpperCase())
.sort(),
]

const queryParams = orderedKeys.join(',')

const queryRange = orderedKeys
.map((key) => {
if (key === 'ital') return null
Expand All @@ -137,5 +137,5 @@ export const toGoogleVariableFontUrl = (variableFonts: any[]) => {
}

export function pascalCase(str: string) {
return startCase(camelCase(str))
return startCase(str).replace(/\s/g, '')
}

1 comment on commit 81cfd40

@vercel
Copy link

@vercel vercel bot commented on 81cfd40 May 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

css-gui – ./

css-gui.vercel.app
css-gui-components-ai.vercel.app
css-gui-git-main-components-ai.vercel.app

Please sign in to comment.