Skip to content

Commit

Permalink
feat: display user snapshot position by category (#2459)
Browse files Browse the repository at this point in the history
* feat: display user snapshot position by category

* add badge
  • Loading branch information
viet-nv authored Dec 26, 2023
1 parent ffac488 commit c987dde
Show file tree
Hide file tree
Showing 3 changed files with 735 additions and 8 deletions.
18 changes: 16 additions & 2 deletions src/components/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ interface TabsProps {
onChange: (activeKey: string | number) => void
className?: string
horizontalWrapperStyle?: CSSProperties
tabItemStyle?: CSSProperties
tabItemActiveStyle?: CSSProperties
}

const Wrapper = styled.div(({ theme }) => ({
Expand Down Expand Up @@ -41,7 +43,15 @@ const TabHeaderItem = styled.div<{ active: boolean }>(({ theme, active }) => ({
cursor: 'pointer',
}))

const Tabs: FC<TabsProps> = ({ activeKey, items, className, onChange, horizontalWrapperStyle = {} }) => {
const Tabs: FC<TabsProps> = ({
activeKey,
items,
className,
onChange,
horizontalWrapperStyle = {},
tabItemStyle = {},
tabItemActiveStyle = {},
}) => {
return (
<Wrapper className={className}>
<TabHeader>
Expand All @@ -51,7 +61,11 @@ const Tabs: FC<TabsProps> = ({ activeKey, items, className, onChange, horizontal
renderItem={key => {
const label = items.find(i => +i.key === +key)?.label || ''
return (
<TabHeaderItem onClick={() => onChange(key)} active={+key === +activeKey}>
<TabHeaderItem
onClick={() => onChange(key)}
active={+key === +activeKey}
style={+key !== +activeKey ? tabItemStyle : tabItemActiveStyle}
>
{label}
</TabHeaderItem>
)
Expand Down
Loading

0 comments on commit c987dde

Please sign in to comment.