mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-02-17 01:12:37 +01:00
Add NitroCardView
This commit is contained in:
parent
a73b73aa68
commit
8d6167e3e2
0
src/layout/Layout.scss
Normal file
0
src/layout/Layout.scss
Normal file
0
src/layout/card/NitroCardView.scss
Normal file
0
src/layout/card/NitroCardView.scss
Normal file
16
src/layout/card/NitroCardView.tsx
Normal file
16
src/layout/card/NitroCardView.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import { FC } from 'react';
|
||||
import { DraggableWindow } from '../../hooks/draggable-window/DraggableWindow';
|
||||
import { NitroCardViewProps } from './NitroCardView.types';
|
||||
|
||||
export const NitroCardView: FC<NitroCardViewProps> = props =>
|
||||
{
|
||||
const { className = '' } = props;
|
||||
|
||||
return (
|
||||
<DraggableWindow handle=".drag-handler">
|
||||
<div className={ 'nitro-card d-flex flex-column ' + className }>
|
||||
{ props.children }
|
||||
</div>
|
||||
</DraggableWindow>
|
||||
);
|
||||
}
|
4
src/layout/card/NitroCardView.types.ts
Normal file
4
src/layout/card/NitroCardView.types.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface NitroCardViewProps
|
||||
{
|
||||
className?: string;
|
||||
}
|
0
src/layout/card/content/NitroCardContentView.scss
Normal file
0
src/layout/card/content/NitroCardContentView.scss
Normal file
11
src/layout/card/content/NitroCardContentView.tsx
Normal file
11
src/layout/card/content/NitroCardContentView.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import { FC } from 'react';
|
||||
import { NitroCardContentViewProps } from './NitroCardContextView.types';
|
||||
|
||||
export const NitroCardContentView: FC<NitroCardContentViewProps> = props =>
|
||||
{
|
||||
return (
|
||||
<div className="bg-light rounded-bottom border border-top-0 px-3 py-2 shadow overflow-hidden content-area">
|
||||
{ props.children }
|
||||
</div>
|
||||
);
|
||||
}
|
4
src/layout/card/content/NitroCardContextView.types.ts
Normal file
4
src/layout/card/content/NitroCardContextView.types.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface NitroCardContentViewProps
|
||||
{
|
||||
|
||||
}
|
2
src/layout/card/content/index.ts
Normal file
2
src/layout/card/content/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './NitroCardContentView';
|
||||
export * from './NitroCardContextView.types';
|
0
src/layout/card/header/NitroCardHeaderView.scss
Normal file
0
src/layout/card/header/NitroCardHeaderView.scss
Normal file
18
src/layout/card/header/NitroCardHeaderView.tsx
Normal file
18
src/layout/card/header/NitroCardHeaderView.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import { FC } from 'react';
|
||||
import { NitroCardHeaderViewProps } from './NitroCardHeaderView.types';
|
||||
|
||||
export const NitroCardHeaderView: FC<NitroCardHeaderViewProps> = props =>
|
||||
{
|
||||
const { headerText = null, onCloseClick = null } = props;
|
||||
|
||||
return (
|
||||
<div className="drag-handler d-flex align-items-center bg-primary border border-bottom-0 rounded-top px-3 py-1">
|
||||
<div className="d-flex flex-grow-1 justify-content-center align-items-center">
|
||||
<div className="h4 m-0 text-white text-shadow">{ headerText }</div>
|
||||
</div>
|
||||
<div className="cursor-pointer" onClick={ onCloseClick }>
|
||||
<i className="fas fa-times"></i>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
7
src/layout/card/header/NitroCardHeaderView.types.ts
Normal file
7
src/layout/card/header/NitroCardHeaderView.types.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { MouseEvent } from 'react';
|
||||
|
||||
export interface NitroCardHeaderViewProps
|
||||
{
|
||||
headerText: string;
|
||||
onCloseClick: (event: MouseEvent) => void;
|
||||
}
|
2
src/layout/card/header/index.ts
Normal file
2
src/layout/card/header/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './NitroCardHeaderView';
|
||||
export * from './NitroCardHeaderView.types';
|
5
src/layout/card/index.ts
Normal file
5
src/layout/card/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export * from './content';
|
||||
export * from './header';
|
||||
export * from './NitroCardView';
|
||||
export * from './NitroCardView.types';
|
||||
export * from './tabs';
|
0
src/layout/card/tabs/NitroCardTabsView.scss
Normal file
0
src/layout/card/tabs/NitroCardTabsView.scss
Normal file
11
src/layout/card/tabs/NitroCardTabsView.tsx
Normal file
11
src/layout/card/tabs/NitroCardTabsView.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import { FC } from 'react';
|
||||
import { NitroCardTabsViewProps } from './NitroCardTabsView.types';
|
||||
|
||||
export const NitroCardTabsView: FC<NitroCardTabsViewProps> = props =>
|
||||
{
|
||||
return (
|
||||
<ul className="nav nav-tabs justify-content-center bg-secondary border-start border-end px-3 pt-1">
|
||||
{ props.children }
|
||||
</ul>
|
||||
);
|
||||
}
|
4
src/layout/card/tabs/NitroCardTabsView.types.ts
Normal file
4
src/layout/card/tabs/NitroCardTabsView.types.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface NitroCardTabsViewProps
|
||||
{
|
||||
|
||||
}
|
3
src/layout/card/tabs/index.ts
Normal file
3
src/layout/card/tabs/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './NitroCardTabsView';
|
||||
export * from './NitroCardTabsView.types';
|
||||
export * from './tabs-item';
|
14
src/layout/card/tabs/tabs-item/NitroCardTabsItemView.tsx
Normal file
14
src/layout/card/tabs/tabs-item/NitroCardTabsItemView.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
import classNames from 'classnames';
|
||||
import { FC } from 'react';
|
||||
import { NitroCardTabsItemViewProps } from './NitroCardTabsItemView.types';
|
||||
|
||||
export const NitroCardTabsItemView: FC<NitroCardTabsItemViewProps> = props =>
|
||||
{
|
||||
const { tabText = '', isActive = false, onClick = null } = props;
|
||||
|
||||
return (
|
||||
<li className="nav-item me-1 cursor-pointer" onClick={ onClick }>
|
||||
<span className={ 'nav-link ' + classNames({ 'active': isActive }) }>{ tabText }</span>
|
||||
</li>
|
||||
);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import { MouseEventHandler } from 'react';
|
||||
|
||||
export interface NitroCardTabsItemViewProps
|
||||
{
|
||||
tabText: string;
|
||||
isActive: boolean;
|
||||
onClick: MouseEventHandler<HTMLLIElement>;
|
||||
}
|
2
src/layout/card/tabs/tabs-item/index.ts
Normal file
2
src/layout/card/tabs/tabs-item/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './NitroCardTabsItemView';
|
||||
export * from './NitroCardTabsItemView.types';
|
1
src/layout/index.ts
Normal file
1
src/layout/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './card';
|
Loading…
x
Reference in New Issue
Block a user