Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: tab label overflow style when there is only one tab (#7665)

pengx17812fdd27b56e
diff --git a/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx b/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx
index 09cf0f050c..fda509f045 100644
--- a/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx
+++ b/packages/frontend/core/src/modules/app-tabs-header/views/app-tabs-header.tsx
@@ -125,8 +125,8 @@ const WorkbenchTab = ({
</Fragment>
);
})}
- {!workbench.pinned && tabsLength > 1 ? (
- <div className={styles.tabCloseButtonWrapper}>
+ <div className={styles.tabCloseButtonWrapper}>
+ {!workbench.pinned && tabsLength > 1 ? (
<button
data-testid="close-tab-button"
className={styles.tabCloseButton}
@@ -134,8 +134,8 @@ const WorkbenchTab = ({
>
<CloseIcon />
</button>
- </div>
- ) : null}
+ ) : null}
+ </div>
</div>
);
};
diff --git a/packages/frontend/core/src/modules/app-tabs-header/views/styles.css.ts b/packages/frontend/core/src/modules/app-tabs-header/views/styles.css.ts
index 3b0384454d..f359f00a25 100644
--- a/packages/frontend/core/src/modules/app-tabs-header/views/styles.css.ts
+++ b/packages/frontend/core/src/modules/app-tabs-header/views/styles.css.ts
@@ -148,7 +148,7 @@ export const tabCloseButtonWrapper = style({
paddingRight: 4,
justifyContent: 'flex-end',
selectors: {
- [`${tab}:is([data-active=true], :hover) &`]: {
+ [`${tab}:is([data-active=true], :hover) &:not(:empty)`]: {
width: 40,
},
[`${tab}[data-active=true] &`]: {