Skip to content

Commit

Permalink
feat(editor): improve group title display for checkbox columns
Browse files Browse the repository at this point in the history
  • Loading branch information
zzj3720 committed Jan 9, 2025
1 parent 8e8058a commit 20ca4f3
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions blocksuite/affine/data-view/src/core/group-by/group-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ const GroupTitleMobile = (
readonly: ops.readonly,
};

const showColumnName = groupData.property.type$.value === 'checkbox';
const columnName = showColumnName
? html`<span class="group-header-title"
>${groupData.property.name$.value}</span
>`
: nothing;

return html`
<style>
.group-header-count {
Expand Down Expand Up @@ -83,11 +90,17 @@ const GroupTitleMobile = (
font-size: 16px;
color: ${unsafeCSSVarV2('icon/primary')};
}
.group-header-title {
color: ${unsafeCSSVarV2('text/primary')};
font-size: var(--data-view-cell-text-size);
}
</style>
<div
style="display:flex;align-items:center;gap: 8px;overflow: hidden;height: 22px;"
>
${icon} ${renderUniLit(data.view, props)} ${GroupHeaderCount(groupData)}
${icon} ${renderUniLit(data.view, props)} ${columnName}
${GroupHeaderCount(groupData)}
</div>
${ops.readonly
? nothing
Expand Down Expand Up @@ -131,6 +144,13 @@ export const GroupTitle = (
readonly: ops.readonly,
};

const showColumnName = groupData.property.type$.value === 'checkbox';
const columnName = showColumnName
? html`<span class="group-header-title"
>${groupData.property.name$.value}</span
>`
: nothing;

return html`
<style>
.group-header-count {
Expand Down Expand Up @@ -190,11 +210,18 @@ export const GroupTitle = (
fill: var(--affine-icon-color);
color: var(--affine-icon-color);
}
.group-header-title {
color: ${unsafeCSSVarV2('text/primary')};
font-size: var(--data-view-cell-text-size);
margin-left: 4px;
}
</style>
<div
style="display:flex;align-items:center;gap: 8px;overflow: hidden;height: 22px;"
>
${icon} ${renderUniLit(data.view, props)} ${GroupHeaderCount(groupData)}
${icon} ${renderUniLit(data.view, props)} ${columnName}
${GroupHeaderCount(groupData)}
</div>
${ops.readonly
? nothing
Expand Down

0 comments on commit 20ca4f3

Please sign in to comment.