Skip to content

Commit

Permalink
add lipgloss dep to view
Browse files Browse the repository at this point in the history
  • Loading branch information
gzipChrist committed Mar 6, 2023
1 parent 1199210 commit e463cf4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
6 changes: 1 addition & 5 deletions internal/genfile/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// View renders a string representation of the MainModel.
func (m MainModel) View() string {
titleView := KeySwitchArt(m.appName)
descView := "Generated by drexler, with love ❤️"
quitView := "[ctrl+c to quit]"
return "\n" + titleView + "\n" + descView + "\n\n\n\n\n" + quitView + "\n"
return MainView(m.appName)
}
`, s)
Expand Down
17 changes: 15 additions & 2 deletions internal/genfile/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ package genfile

const View = `package tui
import "fmt"
import (
"fmt"
"github.com/charmbracelet/lipgloss"
)
var keyParts = []string{
" _______",
Expand All @@ -14,7 +19,7 @@ var keyParts = []string{
"|/_____\\",
}
func KeySwitchArt(s string) string {
func keySwitchArt(s string) string {
var art string
for i, line := range keyParts {
for _, c := range s {
Expand All @@ -36,4 +41,12 @@ func KeySwitchArt(s string) string {
return art
}
func MainView(s string) string {
titleView := keySwitchArt(s)
descView := "Generated by drexler, with love ❤️"
quitView := lipgloss.NewStyle().Faint(true).SetString("[ctrl+c to quit]").String()
return "\n" + titleView + "\n" + descView + "\n\n\n\n\n" + quitView + "\n"
}
`

0 comments on commit e463cf4

Please sign in to comment.