@@ -11,26 +11,13 @@ import classNames from 'classnames';
1111import { useEuiTheme } from '../../services' ;
1212import { cloneElementWithCss } from '../../services/theme/clone_element' ;
1313import { euiTitleStyles } from './title.styles' ;
14- import { CommonProps , keysOf } from '../common' ;
14+ import { CommonProps } from '../common' ;
1515
16- const titleSizeToClassNameMap = {
17- xxxs : 'euiTitle--xxxsmall' ,
18- xxs : 'euiTitle--xxsmall' ,
19- xs : 'euiTitle--xsmall' ,
20- s : 'euiTitle--small' ,
21- m : 'euiTitle--medium' ,
22- l : 'euiTitle--large' ,
23- } ;
24-
25- export const TITLE_SIZES = keysOf ( titleSizeToClassNameMap ) ;
26- export type EuiTitleSize = keyof typeof titleSizeToClassNameMap ;
27-
28- const textTransformToClassNameMap = {
29- uppercase : 'euiTitle--uppercase' ,
30- } ;
16+ export const TITLE_SIZES = [ 'xxxs' , 'xxs' , 'xs' , 's' , 'm' , 'l' ] as const ;
17+ export type EuiTitleSize = typeof TITLE_SIZES [ number ] ;
3118
32- export const TEXT_TRANSFORM = keysOf ( textTransformToClassNameMap ) ;
33- export type EuiTitleTextTransform = keyof typeof textTransformToClassNameMap ;
19+ export const TEXT_TRANSFORM = [ 'uppercase' ] as const ;
20+ export type EuiTitleTextTransform = typeof TEXT_TRANSFORM [ number ] ;
3421
3522export type EuiTitleProps = CommonProps & {
3623 /**
@@ -56,13 +43,7 @@ export const EuiTitle: FunctionComponent<EuiTitleProps> = ({
5643 textTransform ? styles [ textTransform ] : undefined ,
5744 styles [ size ] ,
5845 ] ;
59- const classes = classNames (
60- 'euiTitle' ,
61- titleSizeToClassNameMap [ size ] ,
62- textTransform ? textTransformToClassNameMap [ textTransform ] : undefined ,
63- className ,
64- children . props . className
65- ) ;
46+ const classes = classNames ( 'euiTitle' , className , children . props . className ) ;
6647
6748 const props = {
6849 css : cssStyles ,
0 commit comments