mirror of
https://github.com/anotherhadi/ilovetui.git
synced 2026-10-05 10:58:26 +02:00
@@ -1,6 +1,6 @@
|
|||||||
import { type BorderCharacters, type BoxRenderable, type ColorInput, BorderChars, CliRenderEvents, TextAttributes } from "@opentui/core";
|
import { type BorderCharacters, type BoxRenderable, type ColorInput, BorderChars, CliRenderEvents, TextAttributes } from "@opentui/core";
|
||||||
import { onResize, useRenderer } from "@opentui/solid";
|
import { onResize, useRenderer } from "@opentui/solid";
|
||||||
import { createMemo, createSignal, For } from "solid-js";
|
import { createMemo, createSignal, Index } from "solid-js";
|
||||||
import { theme } from "../index.ts";
|
import { theme } from "../index.ts";
|
||||||
|
|
||||||
export interface TabItem {
|
export interface TabItem {
|
||||||
@@ -126,6 +126,7 @@ export function Tabs(props: TabsProps) {
|
|||||||
return (
|
return (
|
||||||
<box
|
<box
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
|
height={3}
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
container = el;
|
container = el;
|
||||||
remeasureNextFrame();
|
remeasureNextFrame();
|
||||||
@@ -137,7 +138,7 @@ export function Tabs(props: TabsProps) {
|
|||||||
.join("")}
|
.join("")}
|
||||||
</text>
|
</text>
|
||||||
<box flexDirection="row">
|
<box flexDirection="row">
|
||||||
<For each={segments()}>
|
<Index each={segments()}>
|
||||||
{(s) => (
|
{(s) => (
|
||||||
<>
|
<>
|
||||||
<text selectable={false} fg={borderColor()}>
|
<text selectable={false} fg={borderColor()}>
|
||||||
@@ -145,18 +146,18 @@ export function Tabs(props: TabsProps) {
|
|||||||
</text>
|
</text>
|
||||||
<text
|
<text
|
||||||
selectable={false}
|
selectable={false}
|
||||||
fg={s.isActive ? accent() : muted()}
|
fg={s().isActive ? accent() : muted()}
|
||||||
attributes={s.isActive ? TextAttributes.BOLD : undefined}
|
attributes={s().isActive ? TextAttributes.BOLD : undefined}
|
||||||
onMouseDown={theme.mouse && s.value !== undefined ? () => props.onChange(s.value!) : undefined}
|
onMouseDown={theme.mouse && s().value !== undefined ? () => props.onChange(s().value!) : undefined}
|
||||||
>
|
>
|
||||||
{` ${s.label} `}
|
{` ${s().label} `}
|
||||||
</text>
|
</text>
|
||||||
<text selectable={false} fg={borderColor()}>
|
<text selectable={false} fg={borderColor()}>
|
||||||
{chars.vertical}
|
{chars.vertical}
|
||||||
</text>
|
</text>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</For>
|
</Index>
|
||||||
</box>
|
</box>
|
||||||
<text selectable={false} fg={borderColor()}>
|
<text selectable={false} fg={borderColor()}>
|
||||||
{buildBottomRow(chars, segments(), width())}
|
{buildBottomRow(chars, segments(), width())}
|
||||||
|
|||||||
Reference in New Issue
Block a user