File tree 1 file changed +41
-0
lines changed
ui/components/sectioncard 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments