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.

chore(editor): remove redundant card-style-panel component (#10973)

fundonb88e7f0e3523
diff --git a/blocksuite/affine/blocks/block-root/src/edgeless/components/panel/card-style-panel.ts b/blocksuite/affine/blocks/block-root/src/edgeless/components/panel/card-style-panel.ts
deleted file mode 100644
index d5e67a268c..0000000000
--- a/blocksuite/affine/blocks/block-root/src/edgeless/components/panel/card-style-panel.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import type { EmbedCardStyle } from '@blocksuite/affine-model';
-import { WithDisposable } from '@blocksuite/global/lit';
-import { css, html, LitElement, nothing, type TemplateResult } from 'lit';
-import { property } from 'lit/decorators.js';
-import { classMap } from 'lit/directives/class-map.js';
-import { repeat } from 'lit/directives/repeat.js';
-
-export class CardStylePanel extends WithDisposable(LitElement) {
- static override styles = css`
- :host {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- }
-
- icon-button {
- padding: var(--1, 0px);
- justify-content: center;
- }
-
- icon-button.selected {
- border: 1px solid var(--affine-brand-color);
- }
- `;
-
- override render() {
- const options = this.options;
- if (!options?.length) return nothing;
-
- return repeat(
- options,
- options => options.style,
- ({ style, Icon, tooltip }) => html`
- <icon-button
- width="76px"
- height="76px"
- class=${classMap({
- selected: this.value === style,
- })}
- @click=${() => {
- this.onSelect(style);
- this.value = style;
- }}
- >
- ${Icon}
- <affine-tooltip .offset=${4}>${tooltip}</affine-tooltip>
- </icon-button>
- `
- );
- }
-
- @property({ attribute: false })
- accessor onSelect!: (value: EmbedCardStyle) => void;
-
- @property({ attribute: false })
- accessor options!: {
- style: EmbedCardStyle;
- Icon: TemplateResult<1>;
- tooltip: string;
- }[];
-
- @property({ attribute: false })
- accessor value: EmbedCardStyle | undefined = undefined;
-}
diff --git a/blocksuite/affine/blocks/block-root/src/effects.ts b/blocksuite/affine/blocks/block-root/src/effects.ts
index 5d964ff49f..ac81b9e5da 100644
--- a/blocksuite/affine/blocks/block-root/src/effects.ts
+++ b/blocksuite/affine/blocks/block-root/src/effects.ts
@@ -9,7 +9,6 @@ import {
NOTE_SLICER_WIDGET,
NoteSlicer,
} from './edgeless/components/note-slicer/index.js';
-import { CardStylePanel } from './edgeless/components/panel/card-style-panel.js';
import { EdgelessFontFamilyPanel } from './edgeless/components/panel/font-family-panel.js';
import { EdgelessFontWeightAndStylePanel } from './edgeless/components/panel/font-weight-and-style-panel.js';
import { EdgelessLineWidthPanel } from './edgeless/components/panel/line-width-panel.js';
@@ -215,7 +214,6 @@ function registerEdgelessToolbarComponents() {
}
function registerEdgelessPanelComponents() {
- customElements.define('card-style-panel', CardStylePanel);
customElements.define('edgeless-line-width-panel', EdgelessLineWidthPanel);
customElements.define(
'edgeless-font-weight-and-style-panel',
@@ -312,7 +310,6 @@ declare global {
'edgeless-toolbar-button': EdgelessToolbarButton;
'edgeless-connector-handle': EdgelessConnectorHandle;
'note-slicer': NoteSlicer;
- 'card-style-panel': CardStylePanel;
'edgeless-font-family-panel': EdgelessFontFamilyPanel;
'edgeless-font-weight-and-style-panel': EdgelessFontWeightAndStylePanel;
'edgeless-line-width-panel': EdgelessLineWidthPanel;