Skip to content

Commit

Permalink
🐛 fix(styles): adjust responsive helpers for the spacing and typograp…
Browse files Browse the repository at this point in the history
…hy css util classes (#1611)

fix(styles): adjust responsive helpers for the spacing and typography css util classes
  • Loading branch information
hirsch88 authored Feb 7, 2025
1 parent 4388c9a commit 6c64795
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-islands-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': patch
---

**styles**: adjust responsive helpers for the spacing and typography css util classes
10 changes: 7 additions & 3 deletions libs/nx/src/executors/build-styles/generators/spacing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BuildStylesExecutorSchema } from '../schema'
import * as utils from './utils'
import { COLON_SEPARATOR } from './utils'

export const generateSpacing = async (options: BuildStylesExecutorSchema) => {
const tokens = await utils.getTokens({ token: 'size.space', ...options })
Expand Down Expand Up @@ -103,7 +104,8 @@ function generateSpace({ keys, prefix, property, breakpoint = '' }) {
const values = {}
for (const index in keys) {
const key = keys[index]
values[`${breakpoint}:${prefix}-${key}`] = `var(--bal-space-${key}${breakpoint ? `-${breakpoint}` : ''})`
values[`${breakpoint}${COLON_SEPARATOR}${prefix}-${key}`] =
`var(--bal-space-${key}${breakpoint && breakpoint !== 'mobile' ? `-${breakpoint}` : ''})`
}
const rules = utils.styleClass({ property, values, breakpoint, important: true })
return { rules }
Expand All @@ -114,9 +116,11 @@ function generateSpace({ keys, prefix, property, breakpoint = '' }) {
}
for (const index in keys) {
const key = keys[index]
values[`${prefix}-${key}`] = `var(--bal-space-${key}${breakpoint ? `-${breakpoint}` : ''})`
values[`${prefix}-${key}`] =
`var(--bal-space-${key}${breakpoint && breakpoint !== 'mobile' ? `-${breakpoint}` : ''})`
if (breakpoint) {
values[`${breakpoint}:${prefix}-${key}`] = `var(--bal-space-${key}${breakpoint ? `-${breakpoint}` : ''})`
values[`${breakpoint}${COLON_SEPARATOR}${prefix}-${key}`] =
`var(--bal-space-${key}${breakpoint && breakpoint !== 'mobile' ? `-${breakpoint}` : ''})`
}
}
const rules = utils.styleClass({ property, values, breakpoint, important: true })
Expand Down
3 changes: 2 additions & 1 deletion libs/nx/src/executors/build-styles/generators/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ const generateFontSizeRule = ({ keys, property, prefix, breakpoint = undefined }
const values = {}
for (const index in keys) {
const key = keys[index]
values[`${prefix}-${key}`] = `var(--bal-text-size-${key}${breakpoint ? `-${breakpoint}` : ''})`
values[`${prefix}-${key}`] =
`var(--bal-text-size-${key}${breakpoint && breakpoint !== 'mobile' ? `-${breakpoint}` : ''})`
}
return utils.styleClass({ property, values, important: true, breakpoint })
}
Expand Down

0 comments on commit 6c64795

Please sign in to comment.