MCPcopy Create free account
hub / github.com/resend/react-email / ensureBorderStyleFallback

Function ensureBorderStyleFallback

packages/editor/src/utils/styles.ts:271–288  ·  view source on GitHub ↗
(
  styles: Record<string, string | number>,
)

Source from the content-addressed store, hash-verified

269 * fallback so borders show up immediately after setting a width.
270 */
271export function ensureBorderStyleFallback(
272 styles: Record<string, string | number>,
273): Record<string, string | number> {
274 for (const [widthKey, styleKey] of Object.entries(BORDER_WIDTH_TO_STYLE)) {
275 const widthValue = styles[widthKey];
276 if (!widthValue || widthValue === '0' || widthValue === '0px') {
277 continue;
278 }
279 if (!styles[styleKey]) {
280 // Keep shorthand borderStyle authoritative for each side when present.
281 if (styleKey !== 'borderStyle' && styles.borderStyle) {
282 continue;
283 }
284 styles[styleKey] = 'solid';
285 }
286 }
287 return styles;
288}
289
290/**
291 * Resolves conflicts between reset styles and inline styles by expanding

Callers 4

styles.spec.tsFile · 0.90
updateParentBlockStyleFunction · 0.90
customUpdateStylesFunction · 0.90
transformToCssJsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected