Skip to content

Commit d1194f9

Browse files
committed
WIP
1 parent e8c7b26 commit d1194f9

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package sectioncard
2+
3+
import (
4+
tea "github.com/charmbracelet/bubbletea"
5+
"github.com/charmbracelet/lipgloss"
6+
"github.com/dlvhdr/gh-dash/ui/context"
7+
)
8+
9+
type Model struct {
10+
Ctx *context.ProgramContext
11+
Title string
12+
Subtitle string
13+
Description string
14+
content string
15+
}
16+
17+
func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
18+
return m, nil
19+
}
20+
21+
func (m Model) View() string {
22+
styles := m.Ctx.Styles.SectionCard
23+
title := styles.Title.
24+
Render(m.Title)
25+
subtitle := styles.Subtitle.
26+
Render(m.Subtitle)
27+
titleContainer := styles.TitleContainer.
28+
Width(m.Ctx.MainContentWidth).
29+
Render(lipgloss.JoinHorizontal(lipgloss.Center, title, subtitle))
30+
31+
description := m.Ctx.Styles.SectionCard.Description.Render(m.Description)
32+
33+
content := lipgloss.JoinVertical(lipgloss.Left, titleContainer, description)
34+
return m.Ctx.Styles.SectionCard.Root.Copy().
35+
Width(m.Ctx.MainContentWidth).
36+
Render(content)
37+
}
38+
39+
func (m *Model) UpdateProgramContext(ctx *context.ProgramContext) {
40+
m.Ctx = ctx
41+
}

0 commit comments

Comments
 (0)