wip(app): line selection

This commit is contained in:
Adam
2026-01-21 13:31:06 -06:00
parent cb481d9ac8
commit 1e1872aada
8 changed files with 83 additions and 65 deletions

View File

@@ -60,8 +60,8 @@
ol {
margin-top: 0.5rem;
margin-bottom: 1rem;
padding-left: 0;
list-style-position: inside;
padding-left: 1.5rem;
list-style-position: outside;
}
ul {
@@ -76,6 +76,16 @@
margin-bottom: 0.5rem;
}
li > p:first-child {
display: inline;
margin: 0;
}
li > p + p {
display: block;
margin-top: 0.5rem;
}
li::marker {
color: var(--text-weak);
}

View File

@@ -13,6 +13,7 @@ export interface PopoverProps<T extends ValidComponent = "div">
description?: JSXElement
class?: ComponentProps<"div">["class"]
classList?: ComponentProps<"div">["classList"]
portal?: boolean
}
export function Popover<T extends ValidComponent = "div">(props: PopoverProps<T>) {
@@ -26,40 +27,45 @@ export function Popover<T extends ValidComponent = "div">(props: PopoverProps<T>
"class",
"classList",
"children",
"portal",
])
const content = () => (
<Kobalte.Content
data-component="popover-content"
classList={{
...(local.classList ?? {}),
[local.class ?? ""]: !!local.class,
}}
>
{/* <Kobalte.Arrow data-slot="popover-arrow" /> */}
<Show when={local.title}>
<div data-slot="popover-header">
<Kobalte.Title data-slot="popover-title">{local.title}</Kobalte.Title>
<Kobalte.CloseButton
data-slot="popover-close-button"
as={IconButton}
icon="close"
variant="ghost"
aria-label={i18n.t("ui.common.close")}
/>
</div>
</Show>
<Show when={local.description}>
<Kobalte.Description data-slot="popover-description">{local.description}</Kobalte.Description>
</Show>
<div data-slot="popover-body">{local.children}</div>
</Kobalte.Content>
)
return (
<Kobalte gutter={4} {...rest}>
<Kobalte.Trigger as={local.triggerAs ?? "div"} data-slot="popover-trigger" {...(local.triggerProps as any)}>
{local.trigger}
</Kobalte.Trigger>
<Kobalte.Portal>
<Kobalte.Content
data-component="popover-content"
classList={{
...(local.classList ?? {}),
[local.class ?? ""]: !!local.class,
}}
>
{/* <Kobalte.Arrow data-slot="popover-arrow" /> */}
<Show when={local.title}>
<div data-slot="popover-header">
<Kobalte.Title data-slot="popover-title">{local.title}</Kobalte.Title>
<Kobalte.CloseButton
data-slot="popover-close-button"
as={IconButton}
icon="close"
variant="ghost"
aria-label={i18n.t("ui.common.close")}
/>
</div>
</Show>
<Show when={local.description}>
<Kobalte.Description data-slot="popover-description">{local.description}</Kobalte.Description>
</Show>
<div data-slot="popover-body">{local.children}</div>
</Kobalte.Content>
</Kobalte.Portal>
<Show when={local.portal ?? true} fallback={content()}>
<Kobalte.Portal>{content()}</Kobalte.Portal>
</Show>
</Kobalte>
)
}

View File

@@ -198,6 +198,7 @@
[data-slot="session-review-diff-wrapper"] {
position: relative;
overflow: hidden;
}
[data-slot="session-review-comment-anchor"] {
@@ -213,15 +214,15 @@
display: flex;
align-items: center;
justify-content: center;
background: var(--surface-base);
border: 1px solid color-mix(in oklch, var(--icon-info-active) 60%, transparent);
color: var(--icon-info-active);
box-shadow: var(--shadow-xs-border);
background: var(--surface-warning-base);
border: 1px solid var(--border-warning-base);
color: var(--icon-warning-active);
box-shadow: var(--shadow-xs);
cursor: pointer;
&:hover {
background: var(--surface-raised-base-hover);
border-color: var(--icon-info-active);
background: var(--surface-warning-weak);
border-color: var(--border-warning-hover);
}
&:focus {
@@ -240,6 +241,12 @@
max-width: 320px;
}
[data-slot="session-review-comment-popover"] {
display: flex;
flex-direction: column;
gap: 6px;
}
[data-slot="session-review-comment-hover-label"],
[data-slot="session-review-comment-popover-label"] {
font-family: var(--font-family-sans);

View File

@@ -581,6 +581,7 @@ export const SessionReview = (props: SessionReviewProps) => {
}}
>
<Popover
portal={false}
open={isCommentOpen(comment)}
onOpenChange={(open) => {
if (open) {
@@ -632,6 +633,7 @@ export const SessionReview = (props: SessionReviewProps) => {
<Show when={draftTop() !== undefined}>
<div data-slot="session-review-comment-anchor" style={{ top: `${draftTop() ?? 0}px` }}>
<Popover
portal={false}
open={true}
onOpenChange={(open) => {
if (open) return