chat_panel.ts

  1import {
  2    background,
  3    border,
  4    text,
  5} from "./components"
  6import { icon_button } from "../component/icon_button"
  7import { useTheme } from "../theme"
  8
  9export default function chat_panel(): any {
 10    const theme = useTheme()
 11    const layer = theme.middle
 12
 13    const SPACING = 12 as const
 14
 15    const channel_name = {
 16        padding: {
 17            left: SPACING,
 18            right: SPACING,
 19            top: 4,
 20            bottom: 4,
 21        },
 22        hash: {
 23            ...text(layer, "sans", "base"),
 24        },
 25        name: text(layer, "sans", "base"),
 26    }
 27
 28    return {
 29        background: background(layer),
 30        list: {
 31            margin: {
 32                left: SPACING,
 33                right: SPACING,
 34            }
 35        },
 36        channel_select: {
 37            header: {
 38                ...channel_name,
 39                border: border(layer, { bottom: true })
 40            },
 41            item: channel_name,
 42            active_item: {
 43                ...channel_name,
 44                background: background(layer, "on", "active"),
 45            },
 46            hovered_item: {
 47                ...channel_name,
 48                background: background(layer, "on", "hovered"),
 49            },
 50            menu: {
 51                background: background(layer, "on"),
 52                border: border(layer, { bottom: true })
 53            }
 54        },
 55        icon_button: icon_button({
 56            variant: "ghost",
 57            color: "variant",
 58            size: "sm",
 59        }),
 60        input_editor: {
 61            background: background(layer, "on"),
 62            corner_radius: 6,
 63            text: text(layer, "sans", "base"),
 64            placeholder_text: text(layer, "sans", "base", "disabled", {
 65                size: "xs",
 66            }),
 67            selection: theme.players[0],
 68            border: border(layer, "on"),
 69            margin: {
 70                left: SPACING,
 71                right: SPACING,
 72                bottom: SPACING,
 73            },
 74            padding: {
 75                bottom: 4,
 76                left: 8,
 77                right: 8,
 78                top: 4,
 79            },
 80        },
 81        message: {
 82            body: text(layer, "sans", "base"),
 83            sender: {
 84                margin: {
 85                    right: 8,
 86                },
 87                ...text(layer, "sans", "base", { weight: "bold" }),
 88            },
 89            timestamp: text(layer, "sans", "base", "disabled"),
 90            margin: { top: SPACING }
 91        },
 92        last_message_bottom_spacing: SPACING,
 93        continuation_message: {
 94            body: text(layer, "sans", "base"),
 95            sender: {
 96                margin: {
 97                    right: 8,
 98                },
 99                ...text(layer, "sans", "base", { weight: "bold" }),
100            },
101            timestamp: text(layer, "sans", "base", "disabled"),
102
103        },
104        pending_message: {
105            body: text(layer, "sans", "base"),
106            sender: {
107                margin: {
108                    right: 8,
109                },
110                ...text(layer, "sans", "base", "disabled"),
111            },
112            timestamp: text(layer, "sans", "base"),
113        },
114        sign_in_prompt: {
115            default: text(layer, "sans", "base"),
116        }
117    }
118}