-
Notifications
You must be signed in to change notification settings - Fork 17
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
27 changed files
with
467 additions
and
221 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,20 @@ | ||
import { Button, ButtonProps } from '@nextui-org/react'; | ||
import React from 'react'; | ||
|
||
export const EzyButton: React.FC<ButtonProps> = ({ css, children, ...props }) => ( | ||
<Button | ||
{...props} | ||
css={{ | ||
color: '$accents5', | ||
'&:hover': { | ||
color: '$ezy', | ||
}, | ||
'.nextui-drip .nextui-drip-filler': { | ||
fill: '$accents1', | ||
}, | ||
...css, | ||
}} | ||
> | ||
{children} | ||
</Button> | ||
); |
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 @@ | ||
export * from './ezy.button'; |
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,27 @@ | ||
import { CSS, styled } from '@nextui-org/react'; | ||
import React from 'react'; | ||
|
||
export interface Props { | ||
className?: string; | ||
css?: CSS; | ||
} | ||
|
||
const StyledSvg = styled('svg', { | ||
stroke: 'CurrentColor', | ||
}); | ||
|
||
export const EzyIcon: React.FC<Props> = () => ( | ||
<StyledSvg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
opacity="0.95" | ||
d="M10 19L8.54456 19C8.15547 19 7.60137 18.4611 7.60137 18.4611L4.14594 12.5389C3.95136 12.2054 3.95137 11.7946 4.14589 11.4611L7.60132 5.53886C7.79589 5.20541 8.15547 5 8.54456 5L12 5M12 19L15.4554 19C15.8445 19 16.2041 18.7946 16.3987 18.4611L19.8541 12.5389C20.0486 12.2054 20.0486 11.7946 19.8541 11.4611L16.3986 5.53886C16.2041 5.20541 15.8445 5 15.4554 5L14 5" | ||
strokeWidth="2" | ||
/> | ||
</StyledSvg> | ||
); |
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,2 +1,3 @@ | ||
export * from './horizontal-layout.icon'; | ||
export * from './vertical-layout.icon'; | ||
export * from './ezy.icon'; |
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,2 @@ | ||
export * from './menu'; | ||
export * from './menu-item'; |
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,65 @@ | ||
import { styled, VariantProps } from '@nextui-org/react'; | ||
import React from 'react'; | ||
|
||
const StyledMenuItem = styled('div', { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
padding: 10, | ||
|
||
'&:hover': { | ||
color: '$ezy', | ||
}, | ||
|
||
variants: { | ||
active: { | ||
true: { | ||
color: '$ezy', | ||
}, | ||
false: { | ||
color: '$accents5', | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
const IconWrapper = styled('div', { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
|
||
width: 30, | ||
height: 30, | ||
|
||
variants: { | ||
active: { | ||
true: { | ||
transition: 'all 0.2s ease', | ||
bs: '$xs', | ||
br: '$squared', | ||
backgroundColor: '$accents1', | ||
}, | ||
false: { | ||
backgroundColor: 'transparent', | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export type MenuItemData = { | ||
key: string; | ||
|
||
icon: React.ReactElement; | ||
|
||
// eslint-disable-next-line react/no-unused-prop-types | ||
submenu?: React.ReactElement; | ||
}; | ||
|
||
export type MenuItemProps = MenuItemData & { | ||
onClick?: () => void; | ||
} & VariantProps<typeof StyledMenuItem>; | ||
|
||
export const MenuItem: React.FC<MenuItemProps> = ({ key, icon, active = false, onClick }) => ( | ||
<StyledMenuItem key={key} active={active} onClick={onClick}> | ||
<IconWrapper active={active}>{icon}</IconWrapper> | ||
</StyledMenuItem> | ||
); |
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,99 @@ | ||
import { styled } from '@nextui-org/react'; | ||
import React from 'react'; | ||
|
||
import { MenuItem, MenuItemData } from './menu-item'; | ||
|
||
const StyledMenu = styled('div', { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
flex: 1, | ||
|
||
width: 50, | ||
maxWidth: 50, | ||
|
||
backgroundColor: '$background', | ||
|
||
borderRight: 'solid 0.1px $border', | ||
}); | ||
|
||
const SubMenu = styled('div', { | ||
display: 'flex', | ||
flexWrap: 'nowrap', | ||
transition: 'all 0.2s ease', | ||
|
||
borderRight: 'solid 0.1px $border', | ||
|
||
variants: { | ||
isCollapsed: { | ||
true: { | ||
width: 250, | ||
}, | ||
false: { | ||
'& div': { | ||
display: 'none', | ||
}, | ||
width: 0, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
const TopContainer = styled('div', { | ||
borderBottom: 'solid 0.1px $border', | ||
}); | ||
|
||
const BottomContainer = styled('div', { | ||
marginTop: 'auto', | ||
}); | ||
|
||
export interface MenuProps { | ||
items: MenuItemData[]; | ||
|
||
top?: React.ReactNode; | ||
|
||
bottom?: React.ReactNode; | ||
|
||
isCollapsed?: boolean; | ||
|
||
onCollapseChange?: (isCollapsed: boolean) => void; | ||
} | ||
|
||
export const Menu: React.FC<MenuProps> = ({ | ||
items, | ||
bottom, | ||
top, | ||
isCollapsed = false, | ||
onCollapseChange, | ||
}) => { | ||
// const [isCollapsed, setIsCollapsed] = React.useState(true); | ||
const [activeItem, setActiveItem] = React.useState<string>(items[0].key); | ||
|
||
const handleMenuItemClick = (index: string) => { | ||
if (index === activeItem && onCollapseChange) { | ||
onCollapseChange(!isCollapsed); | ||
} else { | ||
setActiveItem(index); | ||
} | ||
}; | ||
|
||
const submenu = items.find((item) => item.key === activeItem)?.submenu; | ||
|
||
return ( | ||
<> | ||
<StyledMenu> | ||
<TopContainer>{top}</TopContainer> | ||
{items.map((item) => ( | ||
<MenuItem | ||
{...item} | ||
active={item.key === activeItem} | ||
onClick={() => { | ||
handleMenuItemClick(item.key); | ||
}} | ||
/> | ||
))} | ||
<BottomContainer>{bottom}</BottomContainer> | ||
</StyledMenu> | ||
<SubMenu isCollapsed={isCollapsed}>{!!submenu && submenu}</SubMenu> | ||
</> | ||
); | ||
}; |
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
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.