Skip to content

Commit

Permalink
콜아웃 이모지 6개로 줄임 (#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
devunt committed Nov 15, 2024
1 parent f307901 commit e0948c5
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 158 deletions.
1 change: 1 addition & 0 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"devDependencies": {
"@iconify-json/lucide": "^1.2.12",
"@iconify-json/simple-icons": "^1.2.11",
"@iconify-json/twemoji": "^1.2.1",
"@pandacss/dev": "^0.47.1",
"@pulumi/pulumi": "^3.138.0",
"@readable/adapter-bun": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/usersite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"devDependencies": {
"@fingerprintjs/fingerprintjs": "^4.5.1",
"@iconify-json/lucide": "^1.2.12",
"@iconify-json/twemoji": "^1.2.1",
"@pandacss/dev": "^0.47.1",
"@pulumi/pulumi": "^3.138.0",
"@readable/adapter-bun": "workspace:*",
Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"sindresorhus",
"stakater",
"stibee",
"tada",
"tini",
"tocs",
"tsup",
Expand Down
61 changes: 46 additions & 15 deletions packages/ui/src/tiptap/node-views/callout/Component.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<script lang="ts">
import { css } from '@readable/styled-system/css';
import { flex } from '@readable/styled-system/patterns';
import { center, flex, grid } from '@readable/styled-system/patterns';
import { createFloatingActions } from '@readable/ui/actions';
import { NodeView, NodeViewContentEditable } from '@readable/ui/tiptap';
import Emoji from './Emoji.svelte';
import HighVoltageIcon from '~icons/twemoji/high-voltage';
import LightBulbIcon from '~icons/twemoji/light-bulb';
import LoudspeakerIcon from '~icons/twemoji/loudspeaker';
import PartyPopperIcon from '~icons/twemoji/party-popper';
import PoliceCarLightIcon from '~icons/twemoji/police-car-light';
import PushpinIcon from '~icons/twemoji/pushpin';
import type { NodeViewProps } from '@readable/ui/tiptap';
import type { Component } from 'svelte';
type Props = NodeViewProps;
Expand All @@ -19,6 +25,15 @@
emojiPickerOpened = false;
},
});
const emojis: Record<string, Component> = {
lightbulb: LightBulbIcon,
loudspeaker: LoudspeakerIcon,
pushpin: PushpinIcon,
rotating_light: PoliceCarLightIcon,
tada: PartyPopperIcon,
zap: HighVoltageIcon,
};
</script>

<NodeView>
Expand Down Expand Up @@ -67,32 +82,48 @@
use:anchor
>
{#if node.attrs.emoji}
<Emoji style={css.raw({ size: '20px' })} emoji={node.attrs.emoji} />
{@const Emoji = emojis[node.attrs.emoji]}
<Emoji class={css({ display: 'block', flex: 'none', size: '20px' })} />
{/if}
</svelte:element>

{#if emojiPickerOpened}
<div
class={flex({
direction: 'column',
class={grid({
columns: 3,
gap: '6px',
borderRadius: '4px',
padding: '5px',
padding: '6px',
backgroundColor: 'surface.primary',
boxShadow: 'emphasize',
width: '280px',
height: '280px',
zIndex: '50',
})}
use:floating
>
{#await import('./Picker.svelte') then { default: Picker }}
<Picker
onselect={(emoji) => updateAttributes({ emoji })}
selectedEmoji={node.attrs.emoji}
bind:open={emojiPickerOpened}
/>
{/await}
{#each Object.entries(emojis) as [emoji, Emoji] (emoji)}
<button
class={center({
borderRadius: '2px',
size: '28px',
_pressed: {
backgroundColor: 'gray.1000/8',
},
_hover: {
backgroundColor: 'gray.1000/8',
},
})}
aria-label={emoji}
aria-pressed={emoji === node.attrs.emoji}
onclick={() => {
updateAttributes({ emoji });
emojiPickerOpened = false;
}}
title={emoji}
type="button"
>
<Emoji class={css({ display: 'block', flex: 'none', size: '20px' })} />
</button>
{/each}
</div>
{/if}
<div class={css({ flexGrow: 1, paddingTop: '2px' })}>
Expand Down
42 changes: 0 additions & 42 deletions packages/ui/src/tiptap/node-views/callout/Emoji.svelte

This file was deleted.

99 changes: 0 additions & 99 deletions packages/ui/src/tiptap/node-views/callout/Picker.svelte

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ui/src/tiptap/node-views/callout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Callout = createNodeView(Component, {

addAttributes() {
return {
emoji: { default: 'bulb' },
emoji: { default: 'lightbulb' },
};
},

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/tiptap/node-views/callout/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const Callout = createServerNodeView({

addAttributes() {
return {
emoji: { default: 'bulb' },
emoji: { default: 'lightbulb' },
};
},
});

0 comments on commit e0948c5

Please sign in to comment.