Skip to content

Commit

Permalink
Remove Sass files and className maps
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Apr 25, 2022
1 parent 007102f commit 5404cb8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
@import 'table/index';
@import 'tabs/index';
@import 'text_diff/index';
@import 'title/index';
@import 'toast/index';
@import 'token/index';
@import 'tool_tip/index';
Expand Down
1 change: 0 additions & 1 deletion src/components/title/_index.scss

This file was deleted.

31 changes: 6 additions & 25 deletions src/components/title/title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,13 @@ import classNames from 'classnames';
import { useEuiTheme } from '../../services';
import { cloneElementWithCss } from '../../services/theme/clone_element';
import { euiTitleStyles } from './title.styles';
import { CommonProps, keysOf } from '../common';
import { CommonProps } from '../common';

const titleSizeToClassNameMap = {
xxxs: 'euiTitle--xxxsmall',
xxs: 'euiTitle--xxsmall',
xs: 'euiTitle--xsmall',
s: 'euiTitle--small',
m: 'euiTitle--medium',
l: 'euiTitle--large',
};

export const TITLE_SIZES = keysOf(titleSizeToClassNameMap);
export type EuiTitleSize = keyof typeof titleSizeToClassNameMap;

const textTransformToClassNameMap = {
uppercase: 'euiTitle--uppercase',
};
export const TITLE_SIZES = ['xxxs', 'xxs', 'xs', 's', 'm', 'l'] as const;
export type EuiTitleSize = typeof TITLE_SIZES[number];

export const TEXT_TRANSFORM = keysOf(textTransformToClassNameMap);
export type EuiTitleTextTransform = keyof typeof textTransformToClassNameMap;
export const TEXT_TRANSFORM = ['uppercase'] as const;
export type EuiTitleTextTransform = typeof TEXT_TRANSFORM[number];

export type EuiTitleProps = CommonProps & {
/**
Expand All @@ -56,13 +43,7 @@ export const EuiTitle: FunctionComponent<EuiTitleProps> = ({
textTransform ? styles[textTransform] : undefined,
styles[size],
];
const classes = classNames(
'euiTitle',
titleSizeToClassNameMap[size],
textTransform ? textTransformToClassNameMap[textTransform] : undefined,
className,
children.props.className
);
const classes = classNames('euiTitle', className, children.props.className);

const props = {
css: cssStyles,
Expand Down

0 comments on commit 5404cb8

Please sign in to comment.