11 changed files with 135 additions and 182 deletions
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 802 B |
@ -0,0 +1,52 @@ |
|||||
|
.tabPill { |
||||
|
width: 91px; |
||||
|
height: 28px; |
||||
|
margin: 0; |
||||
|
padding: 4px 20px; |
||||
|
border: none; |
||||
|
border-radius: 18px; |
||||
|
background: #ffffff; |
||||
|
color: #333333; |
||||
|
font-size: 14px; |
||||
|
font-weight: 400; |
||||
|
line-height: normal; |
||||
|
cursor: pointer; |
||||
|
box-sizing: border-box; |
||||
|
display: inline-flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
gap: 3px; |
||||
|
white-space: nowrap; |
||||
|
flex-shrink: 0; |
||||
|
} |
||||
|
|
||||
|
.tabPill_wide { |
||||
|
width: 97px; |
||||
|
} |
||||
|
|
||||
|
.tabPill__icon { |
||||
|
flex-shrink: 0; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
display: block; |
||||
|
object-fit: contain; |
||||
|
filter: brightness(0) saturate(100%) invert(17%) sepia(0%) saturate(0%) hue-rotate(187deg) brightness(95%) contrast(91%); |
||||
|
} |
||||
|
|
||||
|
.tabPill__label { |
||||
|
flex-shrink: 0; |
||||
|
} |
||||
|
|
||||
|
.tabPill_active { |
||||
|
background: #fbf0ff; |
||||
|
color: #6f47f5; |
||||
|
} |
||||
|
|
||||
|
.tabPill_active .tabPill__icon { |
||||
|
filter: brightness(0) saturate(100%) invert(41%) sepia(56%) saturate(6861%) hue-rotate(241deg) brightness(93%) contrast(106%); |
||||
|
} |
||||
|
|
||||
|
.tabPill:focus-visible { |
||||
|
outline: 2px solid rgba(111, 71, 245, 0.45); |
||||
|
outline-offset: 2px; |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
import type { ButtonHTMLAttributes, ReactNode } from "react"; |
||||
|
|
||||
|
import "./index.scss"; |
||||
|
|
||||
|
export type TabPillProps = ButtonHTMLAttributes<HTMLButtonElement> & { |
||||
|
active?: boolean; |
||||
|
children: ReactNode; |
||||
|
iconSrc?: string; |
||||
|
wide?: boolean; |
||||
|
}; |
||||
|
|
||||
|
export function TabPill({ active, children, className, iconSrc, type = "button", wide, ...props }: TabPillProps) { |
||||
|
const tabPillClassName = ["tabPill", active ? "tabPill_active" : null, wide ? "tabPill_wide" : null, className].filter(Boolean).join(" "); |
||||
|
|
||||
|
return ( |
||||
|
<button className={tabPillClassName} type={type} {...props}> |
||||
|
{iconSrc ? <img className="tabPill__icon" src={iconSrc} alt="" aria-hidden /> : null} |
||||
|
<span className="tabPill__label">{children}</span> |
||||
|
</button> |
||||
|
); |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
export type CreateTabIconName = "all" | "image" | "video" | "voice" | "template" | "character" | "background" | "characterAssets"; |
||||
|
|
||||
|
export const CREATE_TAB_ICON_SRC: Record<CreateTabIconName, string> = { |
||||
|
all: new URL("/src/assets/images/create/tabs/create_tab_all.png", import.meta.url).href, |
||||
|
image: new URL("/src/assets/images/create/tabs/create_tab_image.png", import.meta.url).href, |
||||
|
video: new URL("/src/assets/images/create/tabs/create_tab_video.png", import.meta.url).href, |
||||
|
voice: new URL("/src/assets/images/create/tabs/create_tab_voice.png", import.meta.url).href, |
||||
|
template: new URL("/src/assets/images/create/tabs/create_tab_template.png", import.meta.url).href, |
||||
|
character: new URL("/src/assets/images/create/tabs/create_tab_character.png", import.meta.url).href, |
||||
|
background: new URL("/src/assets/images/create/tabs/create_tab_background.png", import.meta.url).href, |
||||
|
characterAssets: new URL("/src/assets/images/create/tabs/create_tab_character_assets.png", import.meta.url).href, |
||||
|
}; |
||||
Loading…
Reference in new issue