-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
221 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,46 @@ | ||
$h: 60px; | ||
._ { | ||
$h: 60px; | ||
display: flex; | ||
padding-top: $h; | ||
width: 100vw; | ||
height: 100vh; | ||
box-sizing: border-box; | ||
:global { | ||
header { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
height: $h; | ||
text-align: center; | ||
line-height: $h; | ||
background-color: var(--aside-bg-color); | ||
} | ||
aside { | ||
$w: 230px; | ||
flex-basis: $w; | ||
padding: 20px; | ||
width: $w; | ||
height: 100%; | ||
overflow-y: auto; | ||
box-sizing: border-box; | ||
background-color: var(--aside-bg-color); | ||
ul { | ||
margin: 0; | ||
padding: 0; | ||
list-style: none; | ||
} | ||
li { | ||
color: #1a2be1; | ||
&.active { | ||
color: #8c06b8; | ||
pointer-events: none; | ||
} | ||
} | ||
a { | ||
display: block; | ||
padding: 5px 0; | ||
text-decoration: none; | ||
color: inherit; | ||
} | ||
} | ||
main { | ||
flex: 1; | ||
padding: 20px; | ||
box-sizing: border-box; | ||
height: 100%; | ||
overflow-y: auto; | ||
} | ||
.header { | ||
height: $h; | ||
text-align: center; | ||
line-height: $h; | ||
background-color: var(--aside-bg-color); | ||
} | ||
.aside { | ||
$w: 230px; | ||
flex-basis: $w; | ||
padding: 20px; | ||
width: $w; | ||
height: 100%; | ||
overflow-y: auto; | ||
box-sizing: border-box; | ||
background-color: var(--aside-bg-color); | ||
ul { | ||
margin: 0; | ||
padding: 0; | ||
list-style: none; | ||
} | ||
li { | ||
color: #1a2be1; | ||
&.active { | ||
color: #8c06b8; | ||
pointer-events: none; | ||
} | ||
} | ||
a { | ||
display: block; | ||
padding: 5px 0; | ||
text-decoration: none; | ||
color: inherit; | ||
} | ||
} | ||
.main { | ||
padding: 20px; | ||
box-sizing: border-box; | ||
height: 100%; | ||
overflow-y: auto; | ||
} |
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
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,22 @@ | ||
import { Aside, Footer, Header, Layout, Main } from '@pkg/components'; | ||
|
||
export function LayoutPage() { | ||
return ( | ||
<> | ||
<Layout vertical style={{ textAlign: 'center', background: '#efefef' }}> | ||
<Header className="header" style={{ background: 'pink' }}> | ||
header | ||
</Header> | ||
<Layout> | ||
<Aside style={{ width: '200px' }}>aside</Aside> | ||
<Main style={{ background: 'blue' }}>main</Main> | ||
</Layout> | ||
<Layout vertical> | ||
<Aside style={{ background: 'lime' }}>aside</Aside> | ||
<Main>main</Main> | ||
</Layout> | ||
<Footer style={{ background: 'pink' }}>footer</Footer> | ||
</Layout> | ||
</> | ||
); | ||
} |
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,19 @@ | ||
import React from 'react'; | ||
import { BaseLayoutsProps } from './layout.types'; | ||
import { getComponentClass } from '@pkg/shared'; | ||
import { getClassNames } from '@tool-pack/basic'; | ||
|
||
const rootClass = getComponentClass('aside'); | ||
|
||
export const Aside: React.FC<BaseLayoutsProps> = (props) => { | ||
const { children, className, ...rest } = props; | ||
return ( | ||
<aside | ||
{...rest} | ||
className={getClassNames(rootClass, { | ||
[className as string]: className, | ||
})}> | ||
{children} | ||
</aside> | ||
); | ||
}; |
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,19 @@ | ||
import React from 'react'; | ||
import { BaseLayoutsProps } from './layout.types'; | ||
import { getComponentClass } from '@pkg/shared'; | ||
import { getClassNames } from '@tool-pack/basic'; | ||
|
||
const rootClass = getComponentClass('footer'); | ||
|
||
export const Footer: React.FC<BaseLayoutsProps> = (props) => { | ||
const { children, className, ...rest } = props; | ||
return ( | ||
<footer | ||
{...rest} | ||
className={getClassNames(rootClass, { | ||
[className as string]: className, | ||
})}> | ||
{children} | ||
</footer> | ||
); | ||
}; |
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,19 @@ | ||
import React from 'react'; | ||
import { BaseLayoutsProps } from './layout.types'; | ||
import { getComponentClass } from '@pkg/shared'; | ||
import { getClassNames } from '@tool-pack/basic'; | ||
|
||
const rootClass = getComponentClass('header'); | ||
|
||
export const Header: React.FC<BaseLayoutsProps> = (props) => { | ||
const { children, className, ...rest } = props; | ||
return ( | ||
<header | ||
{...rest} | ||
className={getClassNames(rootClass, { | ||
[className as string]: className, | ||
})}> | ||
{children} | ||
</header> | ||
); | ||
}; |
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,23 @@ | ||
import React from 'react'; | ||
import { getComponentClass } from '@pkg/shared'; | ||
import { getClassNames } from '@tool-pack/basic'; | ||
import { BaseLayoutsProps } from './layout.types'; | ||
|
||
const rootClass = getComponentClass('layout'); | ||
export const Layout: React.FC< | ||
BaseLayoutsProps & { | ||
vertical?: boolean; | ||
} | ||
> = (props) => { | ||
const { vertical, className, children, ...rest } = props; | ||
return ( | ||
<section | ||
{...rest} | ||
className={getClassNames(rootClass, { | ||
vertical, | ||
[className as string]: className, | ||
})}> | ||
{children} | ||
</section> | ||
); | ||
}; |
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,19 @@ | ||
import React from 'react'; | ||
import { BaseLayoutsProps } from './layout.types'; | ||
import { getComponentClass } from '@pkg/shared'; | ||
import { getClassNames } from '@tool-pack/basic'; | ||
|
||
const rootClass = getComponentClass('main'); | ||
|
||
export const Main: React.FC<BaseLayoutsProps> = (props) => { | ||
const { children, className, ...rest } = props; | ||
return ( | ||
<main | ||
{...rest} | ||
className={getClassNames(rootClass, { | ||
[className as string]: className, | ||
})}> | ||
{children} | ||
</main> | ||
); | ||
}; |
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,6 @@ | ||
import './layouts.scss'; | ||
export * from './Layout'; | ||
export * from './Header'; | ||
export * from './Footer'; | ||
export * from './Main'; | ||
export * from './Aside'; |
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,3 @@ | ||
import React from 'react'; | ||
|
||
export type BaseLayoutsProps = React.HTMLAttributes<HTMLElement>; |
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,18 @@ | ||
@import '../scss.variable'; | ||
|
||
.#{$PREFIX}layout { | ||
display: flex; | ||
flex: 1; | ||
overflow: hidden; | ||
|
||
&.vertical { | ||
flex-direction: column; | ||
} | ||
} | ||
.#{$PREFIX}aside, | ||
.#{$PREFIX}main { | ||
overflow: auto; | ||
} | ||
.#{$PREFIX}main { | ||
flex: 1; | ||
} |