Files
supabase/apps/docs/features/ui/CodeBlock/CodeBlock.utils.ts
Charis cf3ecc93eb chore(docs): turn on strictNullChecks (#36180)
strictNullChecks was off for docs, which lets errors slip through and
leads to incorrect required/optional typing on Zod-inferred types. This
PR enables strictNullChecks and fixes all the existing violations.
2025-06-04 17:05:37 -04:00

31 lines
575 B
TypeScript

import { type CSSProperties } from 'react'
/*
* As defined in @shikijs/core/dist/chunk-tokens.d.mts
*/
enum FontStyle {
NotSet = -1,
None = 0,
Italic = 1,
Bold = 2,
Underline = 4,
}
export function getFontStyle(styleFlags: number): CSSProperties {
let style: CSSProperties = {}
if (styleFlags & FontStyle.Italic) {
;(style ??= {}).fontStyle = 'italic'
}
if (styleFlags & FontStyle.Bold) {
;(style ??= {}).fontWeight = 'bold'
}
if (styleFlags & FontStyle.Underline) {
;(style ??= {}).textDecoration = 'underline'
}
return style
}