Update layout components

This commit is contained in:
Bill 2022-02-21 11:52:25 -05:00
parent fceabc0aaa
commit 13e0974fb6
5 changed files with 11 additions and 17 deletions

View File

@ -16,12 +16,13 @@ export interface TextProps extends BaseProps<HTMLDivElement>
textEnd?: boolean;
small?: boolean;
wrap?: boolean;
noWrap?: boolean;
textBreak?: boolean;
}
export const Text: FC<TextProps> = props =>
{
const { variant = 'black', fontWeight = null, fontSize = 0, align = null, bold = false, underline = false, italics = false, truncate = false, center = false, textEnd = false, small = false, wrap = false, textBreak = false, ...rest } = props;
const { variant = 'black', fontWeight = null, fontSize = 0, align = null, bold = false, underline = false, italics = false, truncate = false, center = false, textEnd = false, small = false, wrap = false, noWrap = false, textBreak = false, ...rest } = props;
const getClassNames = useMemo(() =>
{
@ -51,10 +52,12 @@ export const Text: FC<TextProps> = props =>
if(wrap) newClassNames.push('text-wrap');
if(noWrap) newClassNames.push('text-nowrap');
if(textBreak) newClassNames.push('text-break');
return newClassNames;
}, [ variant, fontWeight, fontSize, align, bold, underline, italics, truncate, center, textEnd, small, wrap, textBreak ]);
}, [ variant, fontWeight, fontSize, align, bold, underline, italics, truncate, center, textEnd, small, wrap, noWrap, textBreak ]);
return <Base classNames={ getClassNames } { ...rest } />;
}

View File

@ -1,12 +1,11 @@
import { FC, useMemo } from 'react';
import { Column } from '../../../common/Column';
import { Column, ColumnProps } from '../../../common';
import { useNitroCardContext } from '../context';
import { NitroCardContentViewProps } from './NitroCardContextView.types';
export const NitroCardContentView: FC<NitroCardContentViewProps> = props =>
export const NitroCardContentView: FC<ColumnProps> = props =>
{
const { theme = 'primary', classNames = [], ...rest } = props;
const { simple = false } = useNitroCardContext();
const { classNames = [], ...rest } = props;
const { theme = 'primary', simple = false } = useNitroCardContext();
const getClassNames = useMemo(() =>
{

View File

@ -1,7 +0,0 @@
import { ColumnProps } from '../../../common/Column';
export interface NitroCardContentViewProps extends ColumnProps
{
theme?: string;
}

View File

@ -1,2 +1 @@
export * from './NitroCardContentView';
export * from './NitroCardContextView.types';

View File

@ -5,8 +5,8 @@ import { NitroCardHeaderViewProps } from './NitroCardHeaderView.types';
export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
{
const { headerText = null, onCloseClick = null, theme = 'primary' } = props;
const { simple = false } = useNitroCardContext();
const { headerText = null, onCloseClick = null } = props;
const { theme = 'primary', simple = false } = useNitroCardContext();
const onMouseDown = useCallback((event: MouseEvent<HTMLDivElement>) =>
{