From 13e0974fb69e87b62f58269e6bd714c5e4cc8874 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 21 Feb 2022 11:52:25 -0500 Subject: [PATCH] Update layout components --- src/common/Text.tsx | 7 +++++-- src/layout/card/content/NitroCardContentView.tsx | 9 ++++----- src/layout/card/content/NitroCardContextView.types.ts | 7 ------- src/layout/card/content/index.ts | 1 - src/layout/card/header/NitroCardHeaderView.tsx | 4 ++-- 5 files changed, 11 insertions(+), 17 deletions(-) delete mode 100644 src/layout/card/content/NitroCardContextView.types.ts diff --git a/src/common/Text.tsx b/src/common/Text.tsx index 0ea93b57..62cd91ce 100644 --- a/src/common/Text.tsx +++ b/src/common/Text.tsx @@ -16,12 +16,13 @@ export interface TextProps extends BaseProps textEnd?: boolean; small?: boolean; wrap?: boolean; + noWrap?: boolean; textBreak?: boolean; } export const Text: FC = 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 = 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 ; } diff --git a/src/layout/card/content/NitroCardContentView.tsx b/src/layout/card/content/NitroCardContentView.tsx index e8662783..2ada5f99 100644 --- a/src/layout/card/content/NitroCardContentView.tsx +++ b/src/layout/card/content/NitroCardContentView.tsx @@ -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 = props => +export const NitroCardContentView: FC = props => { - const { theme = 'primary', classNames = [], ...rest } = props; - const { simple = false } = useNitroCardContext(); + const { classNames = [], ...rest } = props; + const { theme = 'primary', simple = false } = useNitroCardContext(); const getClassNames = useMemo(() => { diff --git a/src/layout/card/content/NitroCardContextView.types.ts b/src/layout/card/content/NitroCardContextView.types.ts deleted file mode 100644 index 829c149d..00000000 --- a/src/layout/card/content/NitroCardContextView.types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ColumnProps } from '../../../common/Column'; - - -export interface NitroCardContentViewProps extends ColumnProps -{ - theme?: string; -} diff --git a/src/layout/card/content/index.ts b/src/layout/card/content/index.ts index b5d35b45..b0862136 100644 --- a/src/layout/card/content/index.ts +++ b/src/layout/card/content/index.ts @@ -1,2 +1 @@ export * from './NitroCardContentView'; -export * from './NitroCardContextView.types'; diff --git a/src/layout/card/header/NitroCardHeaderView.tsx b/src/layout/card/header/NitroCardHeaderView.tsx index 17c580e8..bf40be1c 100644 --- a/src/layout/card/header/NitroCardHeaderView.tsx +++ b/src/layout/card/header/NitroCardHeaderView.tsx @@ -5,8 +5,8 @@ import { NitroCardHeaderViewProps } from './NitroCardHeaderView.types'; export const NitroCardHeaderView: FC = 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) => {