mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-30 08:50:51 +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;
|
textEnd?: boolean;
|
||||||
small?: boolean;
|
small?: boolean;
|
||||||
wrap?: boolean;
|
wrap?: boolean;
|
||||||
|
noWrap?: boolean;
|
||||||
textBreak?: boolean;
|
textBreak?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Text: FC<TextProps> = props =>
|
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(() =>
|
const getClassNames = useMemo(() =>
|
||||||
{
|
{
|
||||||
@ -51,10 +52,12 @@ export const Text: FC<TextProps> = props =>
|
|||||||
|
|
||||||
if(wrap) newClassNames.push('text-wrap');
|
if(wrap) newClassNames.push('text-wrap');
|
||||||
|
|
||||||
|
if(noWrap) newClassNames.push('text-nowrap');
|
||||||
|
|
||||||
if(textBreak) newClassNames.push('text-break');
|
if(textBreak) newClassNames.push('text-break');
|
||||||
|
|
||||||
return newClassNames;
|
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 } />;
|
return <Base classNames={ getClassNames } { ...rest } />;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import { FC, useMemo } from 'react';
|
import { FC, useMemo } from 'react';
|
||||||
import { Column } from '../../../common/Column';
|
import { Column, ColumnProps } from '../../../common';
|
||||||
import { useNitroCardContext } from '../context';
|
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 { classNames = [], ...rest } = props;
|
||||||
const { simple = false } = useNitroCardContext();
|
const { theme = 'primary', simple = false } = useNitroCardContext();
|
||||||
|
|
||||||
const getClassNames = useMemo(() =>
|
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 './NitroCardContentView';
|
||||||
export * from './NitroCardContextView.types';
|
|
||||||
|
@ -5,8 +5,8 @@ import { NitroCardHeaderViewProps } from './NitroCardHeaderView.types';
|
|||||||
|
|
||||||
export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
|
export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { headerText = null, onCloseClick = null, theme = 'primary' } = props;
|
const { headerText = null, onCloseClick = null } = props;
|
||||||
const { simple = false } = useNitroCardContext();
|
const { theme = 'primary', simple = false } = useNitroCardContext();
|
||||||
|
|
||||||
const onMouseDown = useCallback((event: MouseEvent<HTMLDivElement>) =>
|
const onMouseDown = useCallback((event: MouseEvent<HTMLDivElement>) =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user