mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-19 00:34:23 +01:00
Added width constraints to toast component for proper text wrapping. (#4441)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
ddddecf88a
commit
6e318ba567
@@ -1,6 +1,7 @@
|
|||||||
import { createContext, useContext, type ParentProps, Show } from "solid-js"
|
import { createContext, useContext, type ParentProps, Show } from "solid-js"
|
||||||
import { createStore } from "solid-js/store"
|
import { createStore } from "solid-js/store"
|
||||||
import { useTheme } from "@tui/context/theme"
|
import { useTheme } from "@tui/context/theme"
|
||||||
|
import { useTerminalDimensions } from "@opentui/solid"
|
||||||
import { SplitBorder } from "../component/border"
|
import { SplitBorder } from "../component/border"
|
||||||
import { TextAttributes } from "@opentui/core"
|
import { TextAttributes } from "@opentui/core"
|
||||||
import z from "zod"
|
import z from "zod"
|
||||||
@@ -11,6 +12,7 @@ export type ToastOptions = z.infer<typeof TuiEvent.ToastShow.properties>
|
|||||||
export function Toast() {
|
export function Toast() {
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
const dimensions = useTerminalDimensions()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Show when={toast.currentToast}>
|
<Show when={toast.currentToast}>
|
||||||
@@ -21,6 +23,8 @@ export function Toast() {
|
|||||||
alignItems="flex-start"
|
alignItems="flex-start"
|
||||||
top={2}
|
top={2}
|
||||||
right={2}
|
right={2}
|
||||||
|
width={Math.min(60, dimensions().width - 6)}
|
||||||
|
maxWidth={Math.min(60, dimensions().width - 6)}
|
||||||
paddingLeft={2}
|
paddingLeft={2}
|
||||||
paddingRight={2}
|
paddingRight={2}
|
||||||
paddingTop={1}
|
paddingTop={1}
|
||||||
|
|||||||
Reference in New Issue
Block a user