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(md): better button and spacing in the md popup formatter (#1961)

Seamusa9dba92f737f
diff --git a/js/app/packages/block-md/component/FormatTools.tsx b/js/app/packages/block-md/component/FormatTools.tsx
index 352a24bb61..98f55047a8 100644
--- a/js/app/packages/block-md/component/FormatTools.tsx
+++ b/js/app/packages/block-md/component/FormatTools.tsx
@@ -199,8 +199,8 @@ const InlineFormatButton = (props: {
shortcut={InlineShortcuts[props.format]}
/>
}
- size="icon-md"
- variant={props.selection()?.[props.format] ? 'accent' : 'ghost'}
+ size="icon-sm"
+ variant={props.selection()?.[props.format] ? 'tertiary' : 'ghost'}
onClick={(e: MouseEvent | KeyboardEvent) =>
props.onClick(e as MouseEvent)
}
@@ -250,10 +250,11 @@ export const ElementFormatButton = (props: {
return (
<Button
tooltip={name}
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
variant={
props.selection()?.elementsInRange?.has(props.format)
- ? 'accent'
+ ? 'tertiary'
: 'ghost'
}
onClick={(e: MouseEvent | KeyboardEvent) =>
@@ -451,7 +452,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<DropdownMenu.Trigger>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip={'Text Styles'}
disabled={buttonIsDisabled()}
tabIndex={-1}
@@ -515,7 +517,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<DropdownMenu.Trigger>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip="Text Styles"
disabled={props.buttonIsDisabled()}
tabIndex={-1}
@@ -566,7 +569,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<DropdownMenu.Trigger>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip={props.label ?? 'More Formats'}
disabled={buttonIsDisabled()}
tabIndex={-1}
@@ -612,7 +616,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<DropdownMenu.Trigger>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip={props.label ?? 'More Formats'}
disabled={buttonIsDisabled()}
tabIndex={-1}
@@ -662,6 +667,16 @@ export function FormatTools(props: { withinPopup?: boolean }) {
return (
<div class="flex h-full gap-1">
<Show when={canEdit()}>
+ <ElementFormatButton
+ format="paragraph"
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ nodeFormat('paragraph');
+ }}
+ buttonIsDisabled={buttonIsDisabled}
+ selection={selection}
+ />
<ElementFormatMenu
elements={['heading1', 'heading2', 'heading3']}
icon={TextH}
@@ -709,7 +724,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
/>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
onClick={handleLink}
tooltip={selection()?.hasLinks ? 'Remove Link' : 'Insert Link'}
disabled={buttonIsDisabled()}
@@ -722,7 +738,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<Show when={ENABLE_MARKDOWN_COMMENTS && canComment()}>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip="Comment"
onClick={(e) => {
e.preventDefault();
@@ -852,7 +869,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<div class="flex gap-1 h-full">
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
onClick={handleLink}
tooltip={selection()?.hasLinks ? 'Remove Link' : 'Insert Link'}
disabled={buttonIsDisabled()}
@@ -865,7 +883,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<Show when={ENABLE_MARKDOWN_COMMENTS}>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip="Comment"
onClick={(e) => {
e.preventDefault();
@@ -885,7 +904,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<DropdownMenu.Trigger>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip="More"
disabled={buttonIsDisabled()}
tabIndex={-1}
@@ -958,7 +978,8 @@ export function FormatTools(props: { withinPopup?: boolean }) {
<Show when={ENABLE_MARKDOWN_COMMENTS && canComment() && !canEdit()}>
<Button
variant="ghost"
- size="icon-md"
+ size="icon-sm"
+ class="rounded-xs"
tooltip="Comment"
onClick={(e) => {
e.preventDefault();
diff --git a/js/app/packages/block-md/component/MarkdownPopup.tsx b/js/app/packages/block-md/component/MarkdownPopup.tsx
index 45bf20064b..367d4271ae 100644
--- a/js/app/packages/block-md/component/MarkdownPopup.tsx
+++ b/js/app/packages/block-md/component/MarkdownPopup.tsx
@@ -4,7 +4,6 @@ import { useBlockId } from '@core/block';
import type { Completion } from '@core/client/completion';
import { generateTitle } from '@service-cognition/client';
import { ChatMessageMarkdown } from '@core/component/AI/component/message/ChatMessageMarkdown';
-import { DeprecatedTextButton } from '@core/component/DeprecatedTextButton';
// import { AskAi } from '@core/component/GeneralizedPopup/AskAI';
import { GeneralizedPopup } from '@core/component/GeneralizedPopup/Popup';
import { LocationHighlight } from '@core/component/LexicalMarkdown/component/core/Highlights';
@@ -71,6 +70,8 @@ import {
useContext,
} from 'solid-js';
import { FormatTools } from './FormatTools';
+import { Button } from '@ui/components/Button';
+import { Dynamic } from 'solid-js/web';
const MENU_ID = 'markdown-popup';
@@ -377,7 +378,7 @@ export function MarkdownPopup(props: {
return (
<>
<div
- class="gap-1 flex flex-row items-center flex-nowrap"
+ class="gap-1 flex flex-row items-center flex-nowrap p-0"
ref={buttonRowRef}
>
{/*<Show
@@ -407,24 +408,23 @@ export function MarkdownPopup(props: {
<FormatTools withinPopup />
</Show>
<Show when={shouldShowCheckboxToTaskButton()}>
- <DeprecatedTextButton
- width={'w-12'}
- theme="clear"
- icon={isConverting() ? LoadingIcon : CheckSquareIcon}
- text={isConverting() ? 'Converting...' : 'Tasks'}
+ <Button
+ size="sm"
+ variant="ghost"
onClick={handleConvertToTasks}
disabled={isConverting()}
- />
+ >
+ <Dynamic
+ component={isConverting() ? LoadingIcon : CheckSquareIcon}
+ class="size-4"
+ />
+ {isConverting() ? 'Converting...' : 'Tasks'}
+ </Button>
</Show>
- <DeprecatedTextButton
- width={'w-12'}
- theme="clear"
- icon={
- locationCopied()
- ? () => <CheckIcon class="text-success size-4" />
- : LinkIcon
- }
- text={locationCopied() ? 'Copied' : 'Share'}
+ <Button
+ size="sm"
+ class="px-2 text-xs rounded-xs py-1.5"
+ variant="ghost"
onClick={async () => {
const location = editor.read(() =>
$getLocationUrl('md', blockId)
@@ -434,7 +434,13 @@ export function MarkdownPopup(props: {
setLocationCopied(true);
setTimeout(() => setLocationCopied(false), 2000);
}}
- />
+ >
+ <Dynamic
+ component={locationCopied() ? CheckIcon : LinkIcon}
+ class={locationCopied() ? 'text-success-ink size-4' : 'size-4'}
+ />
+ Share
+ </Button>
</div>
<Show when={!completion() && completionType() === 'rewrite'}>