feat: enhance MinAppIcon component with sidebar prop

- Added optional sidebar prop to MinAppIcon for conditional styling.
- Updated Sidebar component to pass sidebar prop to MinAppIcon for consistent appearance in sidebar context.
This commit is contained in:
kangfenmao 2025-04-24 17:03:00 +08:00
parent 53ef8b0f32
commit aeb66195a0
2 changed files with 5 additions and 4 deletions

View File

@ -5,11 +5,12 @@ import styled from 'styled-components'
interface Props {
app: MinAppType
sidebar?: boolean
size?: number
style?: React.CSSProperties
}
const MinAppIcon: FC<Props> = ({ app, size = 48, style }) => {
const MinAppIcon: FC<Props> = ({ app, size = 48, style, sidebar = false }) => {
const _app = DEFAULT_MIN_APPS.find((item) => item.id === app.id)
if (!_app) {
@ -24,7 +25,7 @@ const MinAppIcon: FC<Props> = ({ app, size = 48, style }) => {
width: `${size}px`,
height: `${size}px`,
backgroundColor: _app.background,
...app.style,
...(sidebar ? {} : app.style),
...style
}}
/>

View File

@ -248,7 +248,7 @@ const SidebarOpenedMinappTabs: FC = () => {
theme={theme}
onClick={() => handleOnClick(app)}
className={`${isActive ? 'opened-active' : ''}`}>
<MinAppIcon size={20} app={app} style={{ borderRadius: 6 }} />
<MinAppIcon size={20} app={app} style={{ borderRadius: 6 }} sidebar />
</Icon>
</Dropdown>
</StyledLink>
@ -290,7 +290,7 @@ const PinnedApps: FC = () => {
theme={theme}
onClick={() => openMinappKeepAlive(app)}
className={`${isActive ? 'active' : ''} ${openedKeepAliveMinapps.some((item) => item.id === app.id) ? 'opened-minapp' : ''}`}>
<MinAppIcon size={20} app={app} style={{ borderRadius: 6 }} />
<MinAppIcon size={20} app={app} style={{ borderRadius: 6 }} sidebar />
</Icon>
</Dropdown>
</StyledLink>