Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

style(ui): add new (better) button variants from sidebar buttons to core ui button (#1940)

Seamus4f417d45811f
diff --git a/js/app/bun.lock b/js/app/bun.lock
index f7f98b180e..528c44dab8 100644
--- a/js/app/bun.lock
+++ b/js/app/bun.lock
@@ -1,5 +1,6 @@
{
"lockfileVersion": 1,
+ "configVersion": 0,
"workspaces": {
"": {
"name": "@coparse/monorepo",
diff --git a/js/app/packages/app/component/ResponsiveBlockToolbar.tsx b/js/app/packages/app/component/ResponsiveBlockToolbar.tsx
index caac255ca6..e4564ae470 100644
--- a/js/app/packages/app/component/ResponsiveBlockToolbar.tsx
+++ b/js/app/packages/app/component/ResponsiveBlockToolbar.tsx
@@ -55,12 +55,12 @@ export function ToolButton(props: { tool: BlockTool }) {
props.tool.isActive?.() &&
'bg-accent/20 hover:bg-accent/30 text-accent-ink'
)}
+ size="icon-sm"
>
<Dynamic
component={
props.tool.icon as Component<JSX.SvgSVGAttributes<SVGSVGElement>>
}
- class="size-4 shrink-0"
/>
</Button>
);
diff --git a/js/app/packages/app/component/settings/SettingsButton.tsx b/js/app/packages/app/component/settings/SettingsButton.tsx
index 71bc0803f1..fe023dfbe9 100644
--- a/js/app/packages/app/component/settings/SettingsButton.tsx
+++ b/js/app/packages/app/component/settings/SettingsButton.tsx
@@ -18,7 +18,6 @@ export function SettingsButton() {
return (
<Show when={isSingleSplit()}>
<Button
- suppressInteractionStyling
class="px-0"
tooltip={
<LabelAndHotKey
diff --git a/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx b/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx
index d550c1f5e5..a230ea4d07 100644
--- a/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx
@@ -177,8 +177,9 @@ export function SplitFileMenu(props: {
open() && 'bg-accent/20 hover:bg-accent/30 text-accent-ink',
props.buttonClass
)}
+ size="icon-sm"
>
- <ThreeDots class="size-4 shrink-0" />
+ <ThreeDots />
</DropdownMenu.Trigger>
<DropdownMenu.Portal>
<DropdownMenu.Content class="bg-menu w-44 p-1 border border-edge mt-2">
diff --git a/js/app/packages/block-channel/component/Top.tsx b/js/app/packages/block-channel/component/Top.tsx
index bde6db866f..0b98459cb3 100644
--- a/js/app/packages/block-channel/component/Top.tsx
+++ b/js/app/packages/block-channel/component/Top.tsx
@@ -111,7 +111,6 @@ export function Top(props: TopProps) {
<NotificationsButton
entity={{ id: blockId, type: 'channel' }}
notificationSource={notificationSource}
- buttonSize="sm"
/>
),
},
diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsx
index c318af62d6..e171e1ea14 100644
--- a/js/app/packages/block-email/component/BaseInput.tsx
+++ b/js/app/packages/block-email/component/BaseInput.tsx
@@ -29,8 +29,8 @@ import Spinner from '@icon/bold/spinner-gap-bold.svg';
import ReplyAll from '@icon/regular/arrow-bend-double-up-left.svg';
import Reply from '@icon/regular/arrow-bend-up-left.svg';
import Forward from '@icon/regular/arrow-bend-up-right.svg';
-import Plus from '@icon/regular/plus.svg';
-import Quotes from '@icon/bold/quotes-bold.svg';
+import Paperclip from '@icon/regular/paperclip.svg';
+import Quotes from '@icon/regular/quotes.svg';
import TextAa from '@icon/regular/text-aa.svg';
import Trash from '@icon/regular/trash.svg';
import { DropdownMenu } from '@kobalte/core/dropdown-menu';
@@ -124,6 +124,7 @@ import { queryClient } from '@queries/client';
import { emailKeys } from '@queries/email/keys';
import { stickyGate } from '@core/util/debounce';
import { ENABLE_EMAIL_SCHEDULED_SEND } from '@core/constant/featureFlags';
+import ChevronDown from '@icon/regular/caret-down.svg';
false && fileFolderDrop;
false && fileSelector;
@@ -1239,7 +1240,7 @@ export function BaseInput(props: {
<DropdownMenu>
<DropdownMenu.Trigger>
<div class="px-1">
- <Button showChevron>
+ <Button class="p-0 pr-1 gap-0">
<Switch>
<Match when={effectiveReplyType() === 'reply'}>
<Reply class="h-7 p-1" />
@@ -1252,6 +1253,7 @@ export function BaseInput(props: {
<Forward class="h-7 p-1" />
</Match>
</Switch>
+ <ChevronDown class="size-3" />
</Button>
</div>
</DropdownMenu.Trigger>
@@ -1564,7 +1566,7 @@ export function BaseInput(props: {
</div>
</div>
<div class="flex flex-row w-full h-8 justify-between items-center py-2 px-2 mb-2 space-x-2 allow-css-brackets">
- <div class="flex flex-row items-center gap-2">
+ <div class="flex flex-row items-center gap-1">
<div class="relative">
<Button
ref={(el) =>
@@ -1573,10 +1575,10 @@ export function BaseInput(props: {
onSelect: handleAddAttachments,
}))
}
+ size="icon-sm"
tooltip="Attach"
- class="aspect-square p-1"
>
- <Plus class="h-5" />
+ <Paperclip />
</Button>
</div>
@@ -1585,9 +1587,9 @@ export function BaseInput(props: {
setShowFormatRibbon(!showFormatRibbon());
}}
tooltip="Show formatting toolbar"
- class="aspect-square p-1"
+ size="icon-sm"
>
- <TextAa class="h-5" />
+ <TextAa />
</Button>
<Tooltip
@@ -1596,9 +1598,8 @@ export function BaseInput(props: {
}
>
<KToggleButton
- class={
- 'w-fit disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none [&:focus]:disabled:[--focus-border-inset:0] [&:focus]:[--focus-border-inset:-3px] group'
- }
+ as={Button}
+ size="icon-sm"
pressed={form().replyAppended()}
onChange={() => {
const replyingToID = props.replyingTo()?.replying_to_id;
@@ -1621,9 +1622,7 @@ export function BaseInput(props: {
});
}}
>
- <div class="min-w-[22px] text-xs font-medium font-mono text-ink-muted text-center uppercase leading-none whitespace-nowrap group-data-[pressed]:bg-accent/10 group-data-[pressed]:hover:bg-accent/20 group-data-[pressed='false']:hover:text-ink hover:bg-edge-muted hover-transition-bg group-data-[pressed]:text-accent-ink p-1">
- <Quotes class="inline size-4" />
- </div>
+ <Quotes />
</KToggleButton>
</Tooltip>
<Show when={ENABLE_EMAIL_SCHEDULED_SEND}>
@@ -1648,7 +1647,7 @@ export function BaseInput(props: {
</Show>
</div>
- <Button
+ <button
disabled={
uploadAttachmentMutation.isPending || sendMutation.isPending
}
@@ -1663,7 +1662,7 @@ export function BaseInput(props: {
<ArrowUp class="group-hover:!text-input group-hover:!fill-input !text-accent-ink !fill-accent size-4 transition ease-in-out" />
</div>
</Show>
- </Button>
+ </button>
</div>
</div>
</div>
diff --git a/js/app/packages/block-email/component/ComposeEmailInput.tsx b/js/app/packages/block-email/component/ComposeEmailInput.tsx
index a7dfc67434..fbe9210dd3 100644
--- a/js/app/packages/block-email/component/ComposeEmailInput.tsx
+++ b/js/app/packages/block-email/component/ComposeEmailInput.tsx
@@ -5,7 +5,6 @@ import { FormatRibbon } from '@block-channel/component/FormatRibbon';
import { MacroSignatureButton } from '@block-email/component/MacroSignatureButton';
import { MAX_ATTACHMENTS_BYTES_SIZE } from '@block-email/constants';
import { useHasPaidAccess } from '@core/auth';
-import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
import { FileDropOverlay } from '@core/component/FileDropOverlay';
import { MarkdownTextarea } from '@core/component/LexicalMarkdown/component/core/MarkdownTextarea';
import { createFilesReadyHandler } from '@core/component/LexicalMarkdown/utils/fileUploadUtils';
@@ -383,14 +382,16 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
<PaperclipIcon class="h-5" />
</Button>
</div>
- <DeprecatedIconButton
- theme="base"
- icon={TextAa}
+ <Button
+ variant="ghost"
+ size="icon-sm"
disabled={props.disabled}
- onclick={() => {
+ onClick={() => {
setShowFormatRibbon(!showFormatRibbon());
}}
- />
+ >
+ <TextAa />
+ </Button>
<Show when={ENABLE_EMAIL_SCHEDULED_SEND}>
<EmailDateSelector
sendTime={props.sendTime}
@@ -413,7 +414,7 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
</Show>
</div>
- <Button
+ <button
disabled={props.isSubmitting || props.disabled}
onClick={() => {
handleSend();
@@ -428,7 +429,7 @@ export function ComposeEmailInput(props: ComposeEmailInputProps) {
<ArrowUp class="group-hover:!text-input group-hover:!fill-input !text-accent-ink !fill-accent size-4 transition ease-in-out" />
</div>
</Show>
- </Button>
+ </button>
</Show>
</div>
</div>
diff --git a/js/app/packages/block-email/component/email-date-selector.tsx b/js/app/packages/block-email/component/email-date-selector.tsx
index 483e04e8fe..fa38e576db 100644
--- a/js/app/packages/block-email/component/email-date-selector.tsx
+++ b/js/app/packages/block-email/component/email-date-selector.tsx
@@ -1,11 +1,11 @@
import ClockIcon from '@phosphor-icons/core/assets/regular/clock.svg';
import { DateSelector } from '@block-email/component/date-selector';
import { Tooltip } from '@core/component/Tooltip';
-import { cn } from '@ui/utils/classname';
import { addYears } from 'date-fns/addYears';
import { format } from 'date-fns/format';
import { Show, type VoidComponent } from 'solid-js';
import IconX from '@icon/regular/x.svg';
+import { Button } from '@ui/components/Button';
interface EmailDateSelectorProps {
sendTime?: Date | null;
@@ -35,19 +35,12 @@ export const EmailDateSelector: VoidComponent<EmailDateSelectorProps> = (
: 'Schedule this email'
}
>
- <div
- class={cn(
- 'flex items-center p-1 gap-2 hover:bg-surface-4 group-data-[expanded]/date-selector-trigger:bg-surface-4',
- state.selectedDate &&
- 'bg-accent/20 text-accent-ink hover:bg-accent/15 group-data-[expanded]/date-selector-trigger:bg-accent/20'
- )}
- >
- <ClockIcon class="size-5" />
+ <Button size="icon-sm">
+ <ClockIcon />
<Show when={!props.compact && formattedDate()}>
<span class="text-sm">{formattedDate()}</span>
<Tooltip tooltip="Clear">
<div
- role="button"
tabIndex={0}
class="hover:bg-accent/30"
onPointerDown={(e) => {
@@ -59,7 +52,7 @@ export const EmailDateSelector: VoidComponent<EmailDateSelectorProps> = (
</div>
</Tooltip>
</Show>
- </div>
+ </Button>
</Tooltip>
);
}}
diff --git a/js/app/packages/block-md/component/ComposeTask.tsx b/js/app/packages/block-md/component/ComposeTask.tsx
index e960b79331..ea47505ad3 100644
--- a/js/app/packages/block-md/component/ComposeTask.tsx
+++ b/js/app/packages/block-md/component/ComposeTask.tsx
@@ -538,8 +538,8 @@ export function ComposeTask(props: ComposeTaskProps) {
>
<div class="flex items-center gap-1 p-2">
<Show when={splitPanel?.handle.isPopover()}>
- <Button onMouseDown={handleClose} tabIndex={-1}>
- <XIcon class="size-4" />
+ <Button onMouseDown={handleClose} tabIndex={-1} size="icon-sm">
+ <XIcon />
</Button>
</Show>
<div class="flex items-center gap-2 flex-1">
@@ -547,15 +547,15 @@ export function ComposeTask(props: ComposeTaskProps) {
Create Task
</span>
</div>
- <Show when={title() || content()}>
- <Button
- onMouseDown={handleClearDraft}
- tabIndex={-1}
- tooltip="Clear Draft"
- >
- <TrashIcon class="size-4" />
- </Button>
- </Show>
+ <Button
+ onMouseDown={handleClearDraft}
+ tabIndex={-1}
+ tooltip="Clear Draft"
+ size="icon-sm"
+ disabled={!(content().trim() || title())}
+ >
+ <TrashIcon />
+ </Button>
</div>
<div class="border-b border-edge-muted/50" />
<div class="p-2 flex-1 min-h-0 flex flex-col">
@@ -641,8 +641,9 @@ export function ComposeTask(props: ComposeTaskProps) {
/>
<Button
onClick={handleCreateTask}
- class="border border-edge-muted pr-1"
+ class="px-3 pr-2"
disabled={title().trim().length === 0 || isCreating()}
+ variant="secondary"
>
<Show
when={isCreating()}
diff --git a/js/app/packages/block-md/component/FormatTools.tsx b/js/app/packages/block-md/component/FormatTools.tsx
index 43647731ec..352a24bb61 100644
--- a/js/app/packages/block-md/component/FormatTools.tsx
+++ b/js/app/packages/block-md/component/FormatTools.tsx
@@ -1,5 +1,4 @@
import { markdownBlockErrorSignal } from '@block-md/signal/error';
-import { DeprecatedIconButton } from '@core/component/DeprecatedIconButton';
import { BasicHotkey } from '@core/component/Hotkey';
import {
INSERT_HORIZONTAL_RULE_COMMAND,
@@ -78,6 +77,9 @@ import {
import { mdStore } from '../signal/markdownBlockData';
import { MediaSelector } from './MediaSelector';
import { TableInsert } from './TableInsert';
+import { Button } from '@ui/components/Button';
+import { LabelAndHotKey } from '@core/component/Tooltip';
+import { Dynamic } from 'solid-js/web';
function VerticalBar() {
return <div class="w-px mx-1 h-full bg-edge"></div>;
@@ -190,15 +192,22 @@ const InlineFormatButton = (props: {
}) => {
const icon = InlineIcons[props.format];
return (
- <DeprecatedIconButton
- tooltip={{ label: props.format, shortcut: InlineShortcuts[props.format] }}
- icon={icon}
- theme={props.selection()?.[props.format] ? 'accent' : 'clear'}
+ <Button
+ tooltip={
+ <LabelAndHotKey
+ label={props.format}
+ shortcut={InlineShortcuts[props.format]}
+ />
+ }
+ size="icon-md"
+ variant={props.selection()?.[props.format] ? 'accent' : 'ghost'}
onClick={(e: MouseEvent | KeyboardEvent) =>
props.onClick(e as MouseEvent)
}
disabled={props.buttonIsDisabled()}
- />
+ >
+ <Dynamic component={icon} />
+ </Button>
);
};
@@ -239,19 +248,21 @@ export const ElementFormatButton = (props: {
const name = NodeMenuOptions[props.format]?.label || 'Body';
const icon = NodeMenuOptions[props.format]?.icon;
return (
- <DeprecatedIconButton
- tooltip={{ label: name }}
- icon={icon}
- theme={
+ <Button
+ tooltip={name}
+ size="icon-md"
+ variant={
props.selection()?.elementsInRange?.has(props.format)
? 'accent'
- : 'clear'
+ : 'ghost'
}
onClick={(e: MouseEvent | KeyboardEvent) =>
props.onClick(e as MouseEvent)
}
disabled={props.buttonIsDisabled()}
- />
+ >
+ <Dynamic component={icon} />
+ </Button>
);
};
@@ -438,14 +449,15 @@ export function FormatTools(props: { withinPopup?: boolean }) {
return (
<DropdownMenu open={menuOpen()} onOpenChange={setMenuOpen}>
<DropdownMenu.Trigger>
- <DeprecatedIconButton
- icon={TextAA}
- theme="clear"
- tooltip={{ label: 'Text Styles' }}
- showChevron
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip={'Text Styles'}
disabled={buttonIsDisabled()}
tabIndex={-1}
- />
+ >
+ <TextAA />
+ </Button>
</DropdownMenu.Trigger>
<DropdownMenu.Portal>
<DropdownMenuContent
@@ -501,14 +513,15 @@ export function FormatTools(props: { withinPopup?: boolean }) {
return (
<DropdownMenu open={menuOpen()} onOpenChange={setMenuOpen}>
<DropdownMenu.Trigger>
- <DeprecatedIconButton
- icon={TextAA}
- theme="clear"
- tooltip={{ label: 'Text Styles' }}
- showChevron
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip="Text Styles"
disabled={props.buttonIsDisabled()}
tabIndex={-1}
- />
+ >
+ <TextAA />
+ </Button>
</DropdownMenu.Trigger>
<Show when={!props.buttonIsDisabled()}>
<DropdownMenu.Portal>
@@ -551,14 +564,15 @@ export function FormatTools(props: { withinPopup?: boolean }) {
}) => (
<DropdownMenu>
<DropdownMenu.Trigger>
- <DeprecatedIconButton
- icon={props.icon ?? ThreeDots}
- theme="clear"
- tooltip={{ label: props.label ?? 'More Formats' }}
- showChevron
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip={props.label ?? 'More Formats'}
disabled={buttonIsDisabled()}
tabIndex={-1}
- />
+ >
+ <Dynamic component={props.icon ?? ThreeDots} />
+ </Button>
</DropdownMenu.Trigger>
<Show when={!buttonIsDisabled()}>
<DropdownMenu.Portal>
@@ -596,14 +610,15 @@ export function FormatTools(props: { withinPopup?: boolean }) {
}) => (
<DropdownMenu>
<DropdownMenu.Trigger>
- <DeprecatedIconButton
- icon={props.icon ?? ThreeDots}
- theme="clear"
- tooltip={{ label: props.label ?? 'More Formats' }}
- showChevron
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip={props.label ?? 'More Formats'}
disabled={buttonIsDisabled()}
tabIndex={-1}
- />
+ >
+ <Dynamic component={props.icon ?? ThreeDots} />
+ </Button>
</DropdownMenu.Trigger>
<Show when={!buttonIsDisabled()}>
<DropdownMenu.Portal>
@@ -692,30 +707,32 @@ export function FormatTools(props: { withinPopup?: boolean }) {
]}
buttonIsDisabled={buttonIsDisabled}
/>
- <DeprecatedIconButton
- icon={selection()?.hasLinks ? BrokenLinkIcon : LinkIcon}
- theme="clear"
+ <Button
+ variant="ghost"
+ size="icon-md"
onClick={handleLink}
- tooltip={{
- label: selection()?.hasLinks ? 'Remove Link' : 'Insert Link',
- }}
+ tooltip={selection()?.hasLinks ? 'Remove Link' : 'Insert Link'}
disabled={buttonIsDisabled()}
- />
+ >
+ <Dynamic
+ component={selection()?.hasLinks ? BrokenLinkIcon : LinkIcon}
+ />
+ </Button>
</Show>
<Show when={ENABLE_MARKDOWN_COMMENTS && canComment()}>
- <DeprecatedIconButton
- tooltip={{
- label: 'Comment',
- }}
- theme="clear"
- icon={ChatTeardrop}
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip="Comment"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleInsertComment();
}}
disabled={commentButtonIsDisabled()}
- />
+ >
+ <ChatTeardrop />
+ </Button>
</Show>
</div>
);
@@ -833,30 +850,32 @@ export function FormatTools(props: { withinPopup?: boolean }) {
{/* ------------ Visible at all breakpoints ----------- */}
<div class="flex gap-1 h-full">
- <DeprecatedIconButton
- icon={selection()?.hasLinks ? BrokenLinkIcon : LinkIcon}
- theme="clear"
+ <Button
+ variant="ghost"
+ size="icon-md"
onClick={handleLink}
- tooltip={{
- label: selection()?.hasLinks ? 'Remove Link' : 'Insert Link',
- }}
+ tooltip={selection()?.hasLinks ? 'Remove Link' : 'Insert Link'}
disabled={buttonIsDisabled()}
- />
+ >
+ <Dynamic
+ component={selection()?.hasLinks ? BrokenLinkIcon : LinkIcon}
+ />
+ </Button>
<MediaSelector buttonIsDisabled={buttonIsDisabled} />
<Show when={ENABLE_MARKDOWN_COMMENTS}>
- <DeprecatedIconButton
- tooltip={{
- label: 'Comment',
- }}
- theme="clear"
- icon={ChatTeardrop}
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip="Comment"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleInsertComment();
}}
disabled={commentButtonIsDisabled()}
- />
+ >
+ <ChatTeardrop />
+ </Button>
</Show>
<VerticalBar />
<DropdownMenu
@@ -864,14 +883,15 @@ export function FormatTools(props: { withinPopup?: boolean }) {
onOpenChange={setMoreOptionsOpen}
>
<DropdownMenu.Trigger>
- <DeprecatedIconButton
- icon={PlusSquare}
- theme="clear"
- tooltip={{ label: 'More' }}
- showChevron
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip="More"
disabled={buttonIsDisabled()}
tabIndex={-1}
- />
+ >
+ <PlusSquare />
+ </Button>
</DropdownMenu.Trigger>
<Show when={!buttonIsDisabled()}>
<DropdownMenu.Portal>
@@ -936,19 +956,19 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<div class="w-4"></div>
</Show>
<Show when={ENABLE_MARKDOWN_COMMENTS && canComment() && !canEdit()}>
- <DeprecatedIconButton
- tooltip={{
- label: 'Comment',
- }}
- theme="clear"
- icon={ChatTeardrop}
+ <Button
+ variant="ghost"
+ size="icon-md"
+ tooltip="Comment"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleInsertComment();
}}
disabled={commentButtonIsDisabled()}
- />
+ >
+ <ChatTeardrop />
+ </Button>
</Show>
</>
);
diff --git a/js/app/packages/block-md/component/TopBar.tsx b/js/app/packages/block-md/component/TopBar.tsx
index 1c94b0e337..d9edcc763d 100644
--- a/js/app/packages/block-md/component/TopBar.tsx
+++ b/js/app/packages/block-md/component/TopBar.tsx
@@ -158,7 +158,6 @@ export function TopBar() {
<NotificationsButton
entity={{ id: blockId, type: itemType as EntityType }}
notificationSource={notificationSource}
- buttonSize="sm"
/>
),
},
diff --git a/js/app/packages/channel/Input/ActionButton.tsx b/js/app/packages/channel/Input/ActionButton.tsx
index e118742ac1..47b86cbf91 100644
--- a/js/app/packages/channel/Input/ActionButton.tsx
+++ b/js/app/packages/channel/Input/ActionButton.tsx
@@ -15,6 +15,7 @@ export function InputActionButton(props: {
tooltip={<LabelAndHotKey label={props.label} />}
onClick={(event) => props.onClick?.(event)}
classList={{ 'bg-active': props.active }}
+ size="icon-sm"
>
{props.children}
</Button>
diff --git a/js/app/packages/channel/Input/SendAction.tsx b/js/app/packages/channel/Input/SendAction.tsx
index 1366396ea5..ba4ce2344a 100644
--- a/js/app/packages/channel/Input/SendAction.tsx
+++ b/js/app/packages/channel/Input/SendAction.tsx
@@ -3,8 +3,7 @@ import { cn } from '@ui/utils/classname';
import { useInput, useInputCommands } from './context';
import ArrowUpIcon from '@icon/bold/arrow-up-bold.svg';
import SpinnerIcon from '@icon/bold/spinner-gap-bold.svg';
-import { Button } from '@ui/components/Button';
-import { LabelAndHotKey } from '@core/component/Tooltip';
+import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';
export function SendAction(props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) {
const input = useInput();
@@ -14,32 +13,30 @@ export function SendAction(props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) {
const isBlockedByPending = () => !!input().hasPendingAttachments;
return (
- <Button
- aria-label="Send message"
- title="Send message"
- tooltip={<LabelAndHotKey label="Send message" />}
- data-input-action="send"
- disabled={isBlockedByPending()}
- class={cn(
- 'group transition ease-in-out hover:bg-transparent',
- local.class
- )}
- onPointerDown={(event) => {
- event.preventDefault();
- void commands.send();
- }}
- {...rest}
- >
- <Show
- when={!isBlockedByPending()}
- fallback={<SpinnerIcon class="size-6 animate-spin cursor-disabled" />}
+ <Tooltip tooltip={<LabelAndHotKey label="Send message" />}>
+ <button
+ aria-label="Send message"
+ title="Send message"
+ data-input-action="send"
+ disabled={isBlockedByPending()}
+ class={cn('bg-red! group transition ease-in-out', local.class)}
+ onPointerDown={(event) => {
+ event.preventDefault();
+ void commands.send();
+ }}
+ {...rest}
>
- {resolved() ?? (
- <div class="group-hover:scale-115 group-hover:bg-accent transition ease-in-out size-6 touch:size-8 border border-accent rounded-full flex items-center justify-center">
- <ArrowUpIcon class="group-hover:!text-input group-hover:!fill-input !text-accent-ink !fill-accent size-4 transition ease-in-out" />
- </div>
- )}
- </Show>
- </Button>
+ <Show
+ when={!isBlockedByPending()}
+ fallback={<SpinnerIcon class="size-6 animate-spin cursor-disabled" />}
+ >
+ {resolved() ?? (
+ <div class="group-hover:scale-115 group-hover:bg-accent transition ease-in-out size-6 touch:size-8 border border-accent rounded-full flex items-center justify-center">
+ <ArrowUpIcon class="group-hover:!text-input group-hover:!fill-input !text-accent-ink !fill-accent size-4 transition ease-in-out" />
+ </div>
+ )}
+ </Show>
+ </button>
+ </Tooltip>
);
}
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MediaButtons.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MediaButtons.tsx
index ccc3f4fef4..786202045a 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/MediaButtons.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/MediaButtons.tsx
@@ -51,7 +51,8 @@ export function MediaButtons(props: MediaButtonsProps) {
<Show when={props.enlarge}>
<Dialog.Trigger
as={Button}
- class="size-8 p-0 border-0 bg-transparent hover:bg-hover"
+ class="size-8 p-0"
+ variant="ghost"
tooltip="View full screen"
on:mousedown={(e: MouseEvent) => {
e.preventDefault();
@@ -64,7 +65,8 @@ export function MediaButtons(props: MediaButtonsProps) {
</Show>
<Show when={props.newTab && !isMobile()}>
<Button
- class="size-8 p-0 border-0 bg-transparent hover:bg-hover"
+ class="size-8 p-0"
+ variant="ghost"
tooltip="Open in new tab"
on:mousedown={(e: MouseEvent) => {
e.preventDefault();
@@ -77,7 +79,8 @@ export function MediaButtons(props: MediaButtonsProps) {
</Show>
<Show when={props.delete}>
<Button
- class="size-8 p-0 border-0 bg-transparent hover:bg-hover"
+ class="size-8 p-0"
+ variant="ghost"
tooltip="Remove"
on:mousedown={(e: MouseEvent) => {
e.preventDefault();
@@ -92,7 +95,7 @@ export function MediaButtons(props: MediaButtonsProps) {
);
return (
- <div class="absolute bg-menu top-2 right-2 flex flex-row">
+ <div class="absolute bg-menu top-2 right-2 flex flex-row rounded-xs p-1">
<Show when={!collapsed()}>
<ButtonContent />
</Show>
diff --git a/js/app/packages/core/component/NotificationsModal.tsx b/js/app/packages/core/component/NotificationsModal.tsx
index d71bda5811..70de09edc5 100644
--- a/js/app/packages/core/component/NotificationsModal.tsx
+++ b/js/app/packages/core/component/NotificationsModal.tsx
@@ -38,12 +38,9 @@ export function NotificationsButton(props: {
)}
tooltip="View notifications"
onClick={() => drawerControl.toggle()}
+ size="icon-sm"
>
- <Bell
- class={
- props.buttonSize === 'sm' ? 'size-4 shrink-0' : 'size-5 shrink-0'
- }
- />
+ <Bell />
</Button>
<Suspense fallback={null}>
<Show when={unreadCount() > 0}>
@@ -97,83 +94,3 @@ export function NotificationsDrawer(props: {
</SplitDrawer>
);
}
-
-export type NotificationsModalProps = {
- entity: Entity;
- notificationSource: NotificationSource;
- buttonSize?: 'sm';
-};
-
-export function NotificationsModal(props: NotificationsModalProps) {
- const drawerControl = useDrawerControl(NOTIFICATIONS_DRAWER_ID);
- const notifications = useNotificationsForEntity(
- props.notificationSource,
- props.entity
- );
-
- const unreadCount = createMemo(() => {
- return notifications().filter((n) => !n.viewed_at).length;
- });
-
- const title = () => {
- return (
- <>
- Notifications
- <span class="text-ink-extra-muted">
- {unreadCount() > 0 ? ` - ${unreadCount()} unread` : ''}
- </span>
- </>
- );
- };
-
- return (
- <>
- <div class="relative" tabIndex={-1}>
- <Button
- suppressInteractionStyling
- class={cn(
- 'aspect-square',
- props.buttonSize === 'sm' ? 'size-6' : 'size-8',
- drawerControl.isOpen()
- ? 'bg-accent/10 text-accent-ink hover:bg-accent/20'
- : 'text-ink hover:bg-hover'
- )}
- tooltip="View notifications"
- onClick={() => drawerControl.toggle()}
- >
- <Bell
- class={
- props.buttonSize === 'sm' ? 'size-4 shrink-0' : 'size-5 shrink-0'
- }
- />
- </Button>
- <Suspense fallback={null}>
- <Show when={unreadCount() > 0}>
- <div class="text-[6pt] bg-accent text-page font-semibold rounded-full absolute top-0 right-0 px-[4px] pointer-events-none">
- {unreadCount()}
- </div>
- </Show>
- </Suspense>
- </div>
- <SplitDrawer
- id={NOTIFICATIONS_DRAWER_ID}
- side="right"
- size={768}
- title={title()}
- >
- <Suspense
- fallback={
- <div class="flex justify-center py-8">
- <div class="animate-spin rounded-full h-6 w-6 border-b-2 border-ink-muted"></div>
- </div>
- }
- >
- <Notifications
- entity={props.entity}
- notificationSource={props.notificationSource}
- />
- </Suspense>
- </SplitDrawer>
- </>
- );
-}
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index 5b697f8da5..650fd5c7d0 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -129,6 +129,6 @@ export const ENABLE_AI_AUTO_TAB_ATTACHMENTS = true;
export const ENABLE_FEATURED_SEARCH_RESULTS = true;
-export const ENABLE_NEW_CHANNELS = false;
+export const ENABLE_NEW_CHANNELS = true;
export const ENABLE_PROXY_EMAIL_IMAGES = true;
diff --git a/js/app/packages/ui/components/Button.tsx b/js/app/packages/ui/components/Button.tsx
index 6c83eb14a9..fb3212f665 100644
--- a/js/app/packages/ui/components/Button.tsx
+++ b/js/app/packages/ui/components/Button.tsx
@@ -1,24 +1,55 @@
-import CaretDown from '@phosphor-icons/core/regular/caret-down.svg';
import { cn } from '@ui/utils/classname';
import { Tooltip } from 'core/component/Tooltip';
-import { type JSX, type ParentComponent, Show, splitProps } from 'solid-js';
+import { type JSX, type ParentComponent, splitProps } from 'solid-js';
+
+export type ButtonVariant =
+ | 'primary'
+ | 'secondary'
+ | 'tertiary'
+ | 'destructive'
+ | 'ghost'
+ | 'link'
+ | 'accent';
+
+export type ButtonSize = 'sm' | 'md' | 'lg' | 'icon-sm' | 'icon-md' | 'icon-lg';
type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
- variant?: 'primary' | 'secondary' | 'tertiary' | 'destructive';
+ variant?: ButtonVariant;
+ size?: ButtonSize;
tooltip?: JSX.Element;
- showChevron?: boolean;
- suppressInteractionStyling?: boolean;
+};
+
+const variantStyles: Record<ButtonVariant, string> = {
+ primary:
+ 'bg-ink text-page not-disabled:hover:bg-ink/90 not-disabled:active:bg-ink/80 disabled:bg-ink-extra-muted',
+ secondary:
+ 'bg-transparent text-ink border border-edge-muted not-disabled:hover:bg-ink/10 not-disabled:active:bg-ink/12 disabled:opacity-30',
+ tertiary:
+ 'bg-ink/10 text-ink-muted not-disabled:hover:bg-ink/20 not-disabled:hover:text-ink not-disabled:active:bg-ink/15 disabled:opacity-50',
+ destructive:
+ 'bg-transparent text-failure border border-failure/50 not-disabled:hover:bg-failure/10 not-disabled:active:bg-failure/20 disabled:opacity-50',
+ ghost:
+ 'bg-transparent text-ink-muted not-disabled:hover:bg-ink/10 not-disabled:hover:text-ink not-disabled:active:bg-ink/12 disabled:opacity-30',
+ link: 'bg-transparent text-accent underline-offset-2 not-disabled:hover:underline not-disabled:active:text-accent/80 disabled:text-ink-extra-muted',
+ accent:
+ 'bg-accent text-page not-disabled:hover:bg-accent/90 not-disabled:active:bg-accent/80 disabled:bg-ink-extra-muted',
+};
+
+const sizeStyles: Record<ButtonSize, string> = {
+ sm: 'p-1 text-xs gap-1',
+ md: 'p-2 text-sm gap-1.5',
+ lg: 'p-2.5 text-base gap-2',
+ 'icon-sm': 'p-1 size-7 [&_svg]:size-5',
+ 'icon-md': 'p-1.5 size-9 [&_svg]:size-6',
+ 'icon-lg': 'p-2 size-11 [&_svg]:size-7',
};
/**
* ### The basic button component. When in doubt, use Button.
*
- * @param props.variant - Primary, secondary, tertiary (aka the default), or destructive.
+ * @param props.variant - primary, secondary, tertiary (default), destructive, ghost, or link.
+ * @param props.size - sm, md (default), lg, icon-sm, icon-md, or icon-lg.
* @param props.tooltip - Optional tooltip content to display when hovering over the button.
- * @param props.class - Use for custom styling. Tailwind will be merged automatically, be granular as you like.
- * @param props.showChevron - Show an indicator
- * @param props.suppressInteractionStyling - Override the default interaction styling, e.g. hover bg changes
- * @param props.children - Labels, icons, hotkey hints, etc. The body of the button.
*
* @example
* <Button variant="primary" disabled>
@@ -29,24 +60,26 @@ type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
* // Icon button wrapped in Tooltip with Hotkey
* <Button
* variant="primary"
- * class="aspect-square"
+ * size="icon-md"
* tooltip={<LabelAndHotKey label="Save" shortcut='cmd+s' />}
* >
- * <EntityIcon targetType="pdf" theme='monochrome' size="md" />
+ * <ClipboardIcon />
* </Button>
*
*/
export const Button: ParentComponent<ButtonProps> = (props) => {
const [local, buttonAttributes] = splitProps(props, [
'variant',
+ 'size',
'class',
'children',
'tooltip',
- 'showChevron',
- 'suppressInteractionStyling',
'type',
]);
+ const variant = () => local.variant ?? 'ghost';
+ const size = () => local.size ?? 'md';
+
function MaybeWrapInTooltip(props: { children: JSX.Element }) {
if (!local.tooltip) return props.children;
@@ -58,30 +91,16 @@ export const Button: ParentComponent<ButtonProps> = (props) => {
<button
type={local.type ?? 'button'}
class={cn(
- 'relative flex items-center justify-center gap-[1ch] px-[1ch] py-[0.25lh] border border-transparent',
- 'font-mono font-medium uppercase leading-none',
- !local.suppressInteractionStyling &&
- 'hover:bg-hover focus:[--focus-border-inset:-4px] active:border-accent active:bg-accent active:text-panel disabled:opacity-20 disabled:pointer-events-none disabled:hover:bg-inherit',
+ 'relative inline-flex items-center justify-center font-medium leading-none border border-transparent',
+ 'disabled:cursor-not-allowed',
'touch:min-h-11 touch:min-w-11 touch:[&_svg]:size-6',
-
- {
- 'bg-ink border-ink text-panel hover:bg-accent hover:opacity-80 active:opacity-100':
- 'primary' === local.variant,
- 'border-ink': 'secondary' === local.variant,
- 'border-failure text-failure active:bg-failure hover:bg-failure-bg':
- 'destructive' === local.variant,
- 'p-0 gap-0 items-stretch': local.showChevron,
- },
- // Anything added by the caller will granularly override
+ variantStyles[variant()],
+ sizeStyles[size()],
local.class
)}
{...buttonAttributes}
>
{local.children}
-
- <Show when={!!local.showChevron}>
- <CaretDown class="flex w-3 hover:bg-panel" />
- </Show>
</button>
</MaybeWrapInTooltip>
);