forked from Disciplr-Org/Disciplr-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypography.ts
More file actions
30 lines (26 loc) · 875 Bytes
/
Copy pathtypography.ts
File metadata and controls
30 lines (26 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* Typography utility for mapping design token roles to CSS classes
*
* @example
* const displayClass = getTypographyClass('display');
* // Returns 'text-display' which handles responsive sizing
*/
export type TypographyRole = 'display' | 'title' | 'subtitle' | 'body' | 'caption' | 'mono';
/**
* Maps a typography role to its corresponding CSS class
* The class automatically handles responsive scaling via CSS variables
*
* @param role - The typography role: display, title, body, caption, or mono
* @returns CSS class name for the role
*/
export function getTypographyClass(role: TypographyRole): string {
const classMap: Record<TypographyRole, string> = {
display: 'text-display',
title: 'text-title',
subtitle: 'text-subtitle',
body: 'text-body',
caption: 'text-caption',
mono: 'text-mono',
};
return classMap[role];
}