-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡ feat: header & footer config & layout type was dont
- Loading branch information
1 parent
11c65d8
commit 5dfbdfb
Showing
8 changed files
with
368 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { Flex } from 'antd'; | ||
import { ReactNode } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
import { LayoutTypeEnum } from '..'; | ||
import { getPrefixCls } from '../../theme'; | ||
import { useStyle } from './../style'; | ||
|
||
type LayoutTypeContainerProps = { | ||
pannels: ReactNode[]; | ||
headerandfooter: ReactNode[]; | ||
type: LayoutTypeEnum; | ||
}; | ||
|
||
const LayoutTypeContainer = (props: LayoutTypeContainerProps) => { | ||
const prefixCls = getPrefixCls('layout'); | ||
const { styles } = useStyle(prefixCls); | ||
|
||
const { type, pannels, headerandfooter, ...rest } = props; | ||
|
||
const [LeftPannelDom, RightPannelDom, BottomPannelDom, CenterPannelDom] = pannels; | ||
const [HeaderDom, FooterDom] = headerandfooter; | ||
|
||
console.log('type', type); | ||
|
||
if (type === 'Left&Right') { | ||
return ( | ||
<Flexbox className={styles.layout} {...rest}> | ||
{HeaderDom} | ||
<Flex className={styles.container}> | ||
{LeftPannelDom} | ||
<Flex vertical flex={1}> | ||
{CenterPannelDom} | ||
{BottomPannelDom} | ||
</Flex> | ||
{RightPannelDom} | ||
</Flex> | ||
{FooterDom} | ||
</Flexbox> | ||
); | ||
} | ||
|
||
if (type === 'LeftFull') { | ||
return ( | ||
<Flexbox className={styles.layout} {...rest}> | ||
{HeaderDom} | ||
<Flex className={styles.container}> | ||
{LeftPannelDom} | ||
<Flex vertical flex={1}> | ||
<Flex flex={1}> | ||
{CenterPannelDom} | ||
{RightPannelDom} | ||
</Flex> | ||
{BottomPannelDom} | ||
</Flex> | ||
</Flex> | ||
{FooterDom} | ||
</Flexbox> | ||
); | ||
} | ||
|
||
if (type === 'RightFull') { | ||
return ( | ||
<Flexbox className={styles.layout} {...rest}> | ||
{HeaderDom} | ||
<Flex className={styles.container}> | ||
<Flex vertical flex={1}> | ||
<Flex flex={1}> | ||
{LeftPannelDom} | ||
{CenterPannelDom} | ||
</Flex> | ||
{BottomPannelDom} | ||
</Flex> | ||
{RightPannelDom} | ||
</Flex> | ||
{FooterDom} | ||
</Flexbox> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<Flexbox className={styles.layout} {...rest}> | ||
{HeaderDom} | ||
<Flex className={styles.container}> | ||
{LeftPannelDom} | ||
{CenterPannelDom} | ||
{RightPannelDom} | ||
</Flex> | ||
{BottomPannelDom} | ||
{FooterDom} | ||
</Flexbox> | ||
</> | ||
); | ||
}; | ||
|
||
export { LayoutTypeContainer }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { | ||
AndroidOutlined, | ||
ChromeOutlined, | ||
CloudOutlined, | ||
CodeSandboxOutlined, | ||
FacebookOutlined, | ||
GithubOutlined, | ||
LinkedinOutlined, | ||
MenuUnfoldOutlined, | ||
SmileOutlined, | ||
TwitterOutlined, | ||
YoutubeOutlined, | ||
} from '@ant-design/icons'; | ||
import { Space, Tag } from 'antd'; | ||
|
||
const DefaultLayoutProps = { | ||
header: { | ||
iconConfig: { | ||
icon: <MenuUnfoldOutlined />, | ||
title: 'EditorLayout', | ||
dropdown: { | ||
menu: { | ||
items: [ | ||
{ | ||
key: '1', | ||
label: ( | ||
<a | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href="https://pro-editor.antdigital.dev/" | ||
> | ||
关于 Ant Desgin Pro Editor | ||
</a> | ||
), | ||
}, | ||
{ | ||
key: '2', | ||
label: ( | ||
<a target="_blank" rel="noopener noreferrer"> | ||
全部显示 | ||
</a> | ||
), | ||
icon: <SmileOutlined />, | ||
disabled: true, | ||
}, | ||
{ | ||
key: 'github', | ||
label: ( | ||
<a | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href="https://github.com/ant-design/pro-editor" | ||
> | ||
GitHub | ||
</a> | ||
), | ||
icon: <GithubOutlined />, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
footer: { | ||
extra: ( | ||
<Space size={[0, 8]} wrap> | ||
<Tag icon={<TwitterOutlined />} color="#55acee"> | ||
</Tag> | ||
<Tag icon={<YoutubeOutlined />} color="#cd201f"> | ||
Youtube | ||
</Tag> | ||
<Tag icon={<FacebookOutlined />} color="#3b5999"> | ||
</Tag> | ||
<Tag icon={<LinkedinOutlined />} color="#55acee"> | ||
</Tag> | ||
</Space> | ||
), | ||
iconConfig: { | ||
icon: <CloudOutlined />, | ||
dropdown: { | ||
menu: { | ||
items: [ | ||
{ | ||
key: '1', | ||
label: 'Build with Android', | ||
icon: <AndroidOutlined />, | ||
}, | ||
{ | ||
key: '2', | ||
label: 'Run in Chrome', | ||
icon: <ChromeOutlined />, | ||
}, | ||
{ | ||
key: 'github', | ||
label: 'CodeSandBox', | ||
icon: <CodeSandboxOutlined />, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export { DefaultLayoutProps }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { EditorLayout, Input } from '@ant-design/pro-editor'; | ||
import { Segmented, Space } from 'antd'; | ||
import { useState } from 'react'; | ||
import { DefaultLayoutProps } from './_defaultProps'; | ||
|
||
export default () => { | ||
const [value, setValue] = useState<string>('Bottom'); | ||
|
||
return ( | ||
<Space | ||
direction="vertical" | ||
style={{ | ||
maxWidth: '100%', | ||
}} | ||
> | ||
<Segmented | ||
options={['Left&Right', 'LeftFull', 'RightFull', 'Bottom']} | ||
value={value} | ||
onChange={(e) => setValue(e.toString())} | ||
/> | ||
<EditorLayout | ||
style={{ | ||
maxWidth: '100%', | ||
height: '600px', | ||
}} | ||
header={{ | ||
...DefaultLayoutProps.header, | ||
children: ( | ||
<Input | ||
addonBefore="Options" | ||
placeholder="Search For Some Options" | ||
style={{ width: 250 }} | ||
/> | ||
), | ||
}} | ||
type={value} | ||
footer={{ | ||
...DefaultLayoutProps.footer, | ||
children: <div>Footer</div>, | ||
}} | ||
leftPannel={{ | ||
children: <div>Left Pannel</div>, | ||
}} | ||
/> | ||
</Space> | ||
); | ||
}; |
Oops, something went wrong.