mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +01:00
Update layout components
This commit is contained in:
parent
fceabc0aaa
commit
13e0974fb6
@ -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 } />;
|
||||
}
|
||||
|
@ -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(() =>
|
||||
{
|
||||
|
@ -1,7 +0,0 @@
|
||||
import { ColumnProps } from '../../../common/Column';
|
||||
|
||||
|
||||
export interface NitroCardContentViewProps extends ColumnProps
|
||||
{
|
||||
theme?: string;
|
||||
}
|
@ -1,2 +1 @@
|
||||
export * from './NitroCardContentView';
|
||||
export * from './NitroCardContextView.types';
|
||||
|
@ -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>) =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user