mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-09 23:10:20 +08:00
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:
parent
c20d2d0c17
commit
e2396f3f14
@ -5,11 +5,12 @@ import styled from 'styled-components'
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
app: MinAppType
|
app: MinAppType
|
||||||
|
sidebar?: boolean
|
||||||
size?: number
|
size?: number
|
||||||
style?: React.CSSProperties
|
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)
|
const _app = DEFAULT_MIN_APPS.find((item) => item.id === app.id)
|
||||||
|
|
||||||
if (!_app) {
|
if (!_app) {
|
||||||
@ -24,7 +25,7 @@ const MinAppIcon: FC<Props> = ({ app, size = 48, style }) => {
|
|||||||
width: `${size}px`,
|
width: `${size}px`,
|
||||||
height: `${size}px`,
|
height: `${size}px`,
|
||||||
backgroundColor: _app.background,
|
backgroundColor: _app.background,
|
||||||
...app.style,
|
...(sidebar ? {} : app.style),
|
||||||
...style
|
...style
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -248,7 +248,7 @@ const SidebarOpenedMinappTabs: FC = () => {
|
|||||||
theme={theme}
|
theme={theme}
|
||||||
onClick={() => handleOnClick(app)}
|
onClick={() => handleOnClick(app)}
|
||||||
className={`${isActive ? 'opened-active' : ''}`}>
|
className={`${isActive ? 'opened-active' : ''}`}>
|
||||||
<MinAppIcon size={20} app={app} style={{ borderRadius: 6 }} />
|
<MinAppIcon size={20} app={app} style={{ borderRadius: 6 }} sidebar />
|
||||||
</Icon>
|
</Icon>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
@ -290,7 +290,7 @@ const PinnedApps: FC = () => {
|
|||||||
theme={theme}
|
theme={theme}
|
||||||
onClick={() => openMinappKeepAlive(app)}
|
onClick={() => openMinappKeepAlive(app)}
|
||||||
className={`${isActive ? 'active' : ''} ${openedKeepAliveMinapps.some((item) => item.id === app.id) ? 'opened-minapp' : ''}`}>
|
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>
|
</Icon>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user