-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
1,264 additions
and
9 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 @@ | ||
# Changelog |
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,23 @@ | ||
import { Space } from 'antd'; | ||
import { ActionIcon } from 'lobe-ui'; | ||
import { Settings } from 'lucide-react'; | ||
|
||
export default () => { | ||
return ( | ||
<Space> | ||
<ActionIcon icon={Settings} size="large" active /> | ||
<ActionIcon icon={Settings} size="large" /> | ||
<ActionIcon icon={Settings} /> | ||
<ActionIcon icon={Settings} size="small" /> | ||
<ActionIcon | ||
icon={Settings} | ||
size={{ | ||
blockSize: 40, | ||
fontSize: 24, | ||
strokeWidth: 2, | ||
borderRadius: 20, | ||
}} | ||
/> | ||
</Space> | ||
); | ||
}; |
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,13 @@ | ||
--- | ||
nav: Components | ||
group: Common | ||
title: ActionIcon | ||
--- | ||
|
||
## Usage | ||
|
||
ActionIcon component <https://lucide.dev/> | ||
|
||
<code src="./demos/index.tsx"></code> | ||
|
||
<API></API> |
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,94 @@ | ||
import { DivProps } from '@/types'; | ||
import { LucideIcon } from 'lucide-react'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const Block = styled.div<{ active?: boolean }>` | ||
cursor: pointer; | ||
display: flex; | ||
flex: none; | ||
align-items: center; | ||
justify-content: center; | ||
color: ${({ active, theme }) => (active ? theme.colorText : theme.colorTextQuaternary)}; | ||
background: ${({ active, theme }) => (active ? theme.colorFill : 'transparent')}; | ||
transition: all 0.2s ${({ theme }) => theme.motionEaseOut}; | ||
&:hover { | ||
background: ${({ theme }) => theme.colorFillTertiary}; | ||
} | ||
&:active { | ||
color: ${({ theme }) => theme.colorText}; | ||
background: ${({ theme }) => theme.colorFill}; | ||
} | ||
`; | ||
|
||
export interface ActionIconProps extends DivProps { | ||
active?: boolean; | ||
size?: | ||
| 'large' | ||
| 'normal' | ||
| 'small' | ||
| { | ||
blockSize: number; | ||
fontSize: number; | ||
strokeWidth: number; | ||
borderRadius: number; | ||
}; | ||
icon: LucideIcon; | ||
} | ||
|
||
const ActionIcon: React.FC<ActionIconProps> = ({ | ||
active, | ||
icon, | ||
size = 'normal', | ||
style, | ||
...props | ||
}) => { | ||
let blockSize: number; | ||
let fontSize: number; | ||
let strokeWidth: number; | ||
let borderRadius: number; | ||
const Icon: LucideIcon = icon; | ||
switch (size) { | ||
case 'large': | ||
blockSize = 44; | ||
fontSize = 24; | ||
strokeWidth = 2; | ||
borderRadius = 8; | ||
break; | ||
case 'normal': | ||
blockSize = 36; | ||
fontSize = 24; | ||
strokeWidth = 2; | ||
borderRadius = 5; | ||
break; | ||
case 'small': | ||
blockSize = 28; | ||
fontSize = 20; | ||
strokeWidth = 1.5; | ||
borderRadius = 5; | ||
break; | ||
default: | ||
blockSize = size?.blockSize || 36; | ||
fontSize = size?.fontSize || 24; | ||
strokeWidth = size?.strokeWidth || 2; | ||
borderRadius = size?.borderRadius || 5; | ||
break; | ||
} | ||
return ( | ||
<Block | ||
active={active} | ||
style={{ width: blockSize, height: blockSize, borderRadius, ...style }} | ||
{...props} | ||
> | ||
<Icon size={fontSize} strokeWidth={strokeWidth} /> | ||
</Block> | ||
); | ||
}; | ||
|
||
export default React.memo(ActionIcon); |
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 { DraggablePanel } from 'lobe-ui'; | ||
import styled from 'styled-components'; | ||
|
||
const View = styled.div` | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 240px; | ||
`; | ||
|
||
export default () => { | ||
return ( | ||
<View> | ||
<div style={{ flex: 1 }}>Content</div> | ||
<DraggablePanel placement="bottom">DraggablePanel</DraggablePanel> | ||
</View> | ||
); | ||
}; |
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 { DraggablePanel } from 'lobe-ui'; | ||
import styled from 'styled-components'; | ||
|
||
const View = styled.div` | ||
position: relative; | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 240px; | ||
`; | ||
|
||
export default () => { | ||
return ( | ||
<View> | ||
<DraggablePanel mode="float" placement="left"> | ||
DraggablePanel | ||
</DraggablePanel> | ||
<div style={{ flex: 1 }}>Content</div> | ||
</View> | ||
); | ||
}; |
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,21 @@ | ||
import { DraggablePanel } from 'lobe-ui'; | ||
import styled from 'styled-components'; | ||
|
||
const View = styled.div` | ||
position: relative; | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 240px; | ||
`; | ||
|
||
export default () => { | ||
return ( | ||
<View> | ||
<DraggablePanel placement="left">DraggablePanel</DraggablePanel> | ||
<div style={{ flex: 1 }}>Content</div> | ||
</View> | ||
); | ||
}; |
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 { DraggablePanel } from 'lobe-ui'; | ||
import styled from 'styled-components'; | ||
|
||
const View = styled.div` | ||
position: relative; | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 240px; | ||
`; | ||
|
||
export default () => { | ||
return ( | ||
<View> | ||
<DraggablePanel mode="float" placement="left" pin={false} showHandlerWhenUnexpand> | ||
DraggablePanel | ||
</DraggablePanel> | ||
<div style={{ flex: 1 }}>Content</div> | ||
</View> | ||
); | ||
}; |
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,21 @@ | ||
import { DraggablePanel } from 'lobe-ui'; | ||
import styled from 'styled-components'; | ||
|
||
const View = styled.div` | ||
position: relative; | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 240px; | ||
`; | ||
|
||
export default () => { | ||
return ( | ||
<View> | ||
<div style={{ flex: 1 }}>Content</div> | ||
<DraggablePanel placement="right">DraggablePanel</DraggablePanel> | ||
</View> | ||
); | ||
}; |
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 { DraggablePanel } from 'lobe-ui'; | ||
import styled from 'styled-components'; | ||
|
||
const View = styled.div` | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 240px; | ||
`; | ||
|
||
export default () => { | ||
return ( | ||
<View> | ||
<DraggablePanel placement="top">DraggablePanel</DraggablePanel> | ||
<div style={{ flex: 1 }}>Content</div> | ||
</View> | ||
); | ||
}; |
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,37 @@ | ||
--- | ||
nav: Components | ||
group: Layout | ||
title: DraggablePanel | ||
--- | ||
|
||
## Usage | ||
|
||
DraggablePanel component | ||
|
||
### Mode | ||
|
||
**Fixed** | ||
|
||
<code src="./demos/Left.tsx"></code> | ||
|
||
**Float** | ||
|
||
<code src="./demos/Float.tsx"></code> | ||
|
||
**Pin** | ||
|
||
<code src="./demos/Pin.tsx"></code> | ||
|
||
### Positon | ||
|
||
**Right** | ||
|
||
<code src="./demos/Right.tsx"></code> | ||
|
||
**Top** | ||
|
||
<code src="./demos/Top.tsx"></code> | ||
|
||
**Bottom** | ||
|
||
<code src="./demos/Bottom.tsx"></code> |
Oops, something went wrong.