Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.6.2]

### Added

- Add `fitScreen` prop for `DashboardTemplate` component.

## [1.6.1]

### Added
Expand All @@ -14,12 +20,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

-
-

### Fixed

- Fix unnecessary rerender for Table.
- Fix UploadDragger to Upload.Dragger
- Fix unnecessary rerender for Table.
- Fix UploadDragger to Upload.Dragger

### Deprecated

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "1byte-react-design",
"version": "1.6.1",
"version": "1.6.2-3",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"license": "MIT",
"scripts": {
"build": "webpack --config webpack.config.js",
Expand Down
18 changes: 12 additions & 6 deletions src/templates/DashboardTemplate/DashboardTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@ import { Layout } from '../../molecules';
import DashboardTemplateFooter from './Footer';
import DashboardTemplateHeader from './Header';
import DashboardTemplateSider from './Sider';
import { DashboardTemplateContent, DashboardTemplateStyles } from './styles';
import {
DashboardTemplateContent,
DashboardTemplateSkeletonLayout,
DashboardTemplateStyles,
} from './styles';
import { RdDashboardTemplateComponent, RdDashboardTemplateCompoundedComponent } from './types';

const DashboardTemplateInternal: RdDashboardTemplateComponent = forwardRef((props, ref) => {
const { headerProps, siderProps, footerProps, ...restProps } = props;
const { headerProps, siderProps, footerProps, fitScreen = false, ...restProps } = props;

return (
<DashboardTemplateStyles ref={ref} {...restProps}>
<DashboardTemplateStyles ref={ref} fitScreen={fitScreen} {...restProps}>
{headerProps && <DashboardTemplateHeader {...headerProps} />}

<Layout hasSider={Boolean(siderProps)}>
{siderProps && <DashboardTemplateSider {...siderProps} />}

<Layout>
<DashboardTemplateContent>{props.children}</DashboardTemplateContent>
<DashboardTemplateSkeletonLayout>
<DashboardTemplateContent fitScreen={fitScreen}>
{props.children}
</DashboardTemplateContent>
{footerProps !== false && (
<DashboardTemplateFooter {...footerProps}></DashboardTemplateFooter>
)}
</Layout>
</DashboardTemplateSkeletonLayout>
</Layout>
</DashboardTemplateStyles>
);
Expand Down
26 changes: 23 additions & 3 deletions src/templates/DashboardTemplate/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,36 @@ import { getAliasToken, getComponentToken } from '../../utils';

export const DashboardTemplateStyles = styled(Layout, {
label: 'rd-dashboard-template',
})`
})<{
fitScreen: boolean;
}>`
${() => css`
background: ${getAliasToken('DashboardTemplate', 'colorBgLayout')};
`}

${({ fitScreen }) =>
fitScreen &&
css`
height: 100vh;
`}
`;

export const DashboardTemplateSkeletonLayout = styled(Layout, {
label: 'rd-dashboard-template-skeleton',
})``;

export const DashboardTemplateContent = styled(Layout.Content, {
label: 'rd-dashboard-template-content',
})`
})<{
fitScreen: boolean;
}>`
${() => css`
padding: ${getComponentToken('CenteredTemplate', 'contentPadding') || '32px 32px'};
padding: ${getComponentToken('DashboardTemplate', 'contentPadding') || '32px 32px'};
`}

${({ fitScreen }) =>
fitScreen &&
css`
overflow: auto;
`}
`;
2 changes: 1 addition & 1 deletion src/templates/DashboardTemplate/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type DashboardTemplatePropsExtend = {
headerProps?: RdDashboardTemplateHeaderProps | false;
siderProps?: RdDashboardTemplateSiderProps | false;
footerProps?: RdDashboardTemplateFooterProps | false;
test?: boolean;
fitScreen?: boolean;
};

type DashboardTemplateRefExtend = {};
Expand Down
Loading