mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-30 08:50:51 +01:00
Update common layout components
This commit is contained in:
parent
c6512be476
commit
0dfb3649b8
@ -13,13 +13,14 @@ export interface BaseProps<T = HTMLElement> extends DetailedHTMLProps<HTMLAttrib
|
|||||||
position?: PositionType;
|
position?: PositionType;
|
||||||
float?: FloatType;
|
float?: FloatType;
|
||||||
pointer?: boolean;
|
pointer?: boolean;
|
||||||
|
visible?: boolean;
|
||||||
textColor?: ColorVariantType;
|
textColor?: ColorVariantType;
|
||||||
classNames?: string[];
|
classNames?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Base: FC<BaseProps<HTMLDivElement>> = props =>
|
export const Base: FC<BaseProps<HTMLDivElement>> = props =>
|
||||||
{
|
{
|
||||||
const { ref = null, innerRef = null, fit = false, grow = false, shrink = false, fullWidth = false, fullHeight = false, overflow = null, position = null, float = null, pointer = false, textColor = null, classNames = [], className = '', style = {}, ...rest } = props;
|
const { ref = null, innerRef = null, fit = false, grow = false, shrink = false, fullWidth = false, fullHeight = false, overflow = null, position = null, float = null, pointer = false, visible = null, textColor = null, classNames = [], className = '', style = {}, ...rest } = props;
|
||||||
|
|
||||||
const getClassNames = useMemo(() =>
|
const getClassNames = useMemo(() =>
|
||||||
{
|
{
|
||||||
@ -41,12 +42,14 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
|
|||||||
|
|
||||||
if(pointer) newClassNames.push('cursor-pointer');
|
if(pointer) newClassNames.push('cursor-pointer');
|
||||||
|
|
||||||
|
if(visible !== null) newClassNames.push(visible ? 'visible' : 'invisible');
|
||||||
|
|
||||||
if(textColor) newClassNames.push('text-' + textColor);
|
if(textColor) newClassNames.push('text-' + textColor);
|
||||||
|
|
||||||
if(classNames.length) newClassNames.push(...classNames);
|
if(classNames.length) newClassNames.push(...classNames);
|
||||||
|
|
||||||
return newClassNames;
|
return newClassNames;
|
||||||
}, [ fit, grow, shrink, fullWidth, fullHeight, overflow, position, float, pointer, textColor, classNames ]);
|
}, [ fit, grow, shrink, fullWidth, fullHeight, overflow, position, float, pointer, visible, textColor, classNames ]);
|
||||||
|
|
||||||
const getClassName = useMemo(() =>
|
const getClassName = useMemo(() =>
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { FC, useMemo } from 'react';
|
import { CSSProperties, FC, useMemo } from 'react';
|
||||||
import { CSSProperties } from 'styled-components';
|
|
||||||
import { Base, BaseProps } from './Base';
|
import { Base, BaseProps } from './Base';
|
||||||
import { GridContextProvider } from './GridContext';
|
import { GridContextProvider } from './GridContext';
|
||||||
import { AlignItemType, AlignSelfType, JustifyContentType, SpacingType } from './types';
|
import { AlignItemType, AlignSelfType, JustifyContentType, SpacingType } from './types';
|
||||||
|
@ -1 +1 @@
|
|||||||
export type OverflowType = 'hidden' | 'auto' | 'unset';
|
export type OverflowType = 'auto' | 'hidden' | 'visible' | 'scroll' | 'unset';
|
||||||
|
Loading…
Reference in New Issue
Block a user