Skip to content

Commit

Permalink
add ErrorView to style (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Aug 27, 2023
1 parent 86602d2 commit 2e1122c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ui/style/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
const (
White = "#ffffff"
Gray = "#777777"
Red = "#ff4444"
HighlightColor = "#1DB954"
SemiHighlightColor = "#146542"
BgColor = "#191414"
Expand Down Expand Up @@ -95,3 +96,22 @@ func AsciiArt() lipgloss.Style {
return lipgloss.NewStyle().
Foreground(lipgloss.Color(HighlightColor))
}

const errorMessage = "unexpected error happens.\n\nplease report at\n\nhttps://github.com/JunNishimura/Chatify/issues"

func ErrorView(windowWidth, windowHeight int) string {
return lipgloss.Place(windowWidth, windowHeight, lipgloss.Center, lipgloss.Center,
lipgloss.NewStyle().
Width(60).
Height(10).
BorderStyle(lipgloss.ThickBorder()).
BorderForeground(lipgloss.Color(HighlightColor)).
Background(lipgloss.AdaptiveColor{Dark: BgColor, Light: BgColor}).
Render(lipgloss.Place(50, 10, lipgloss.Center, lipgloss.Center,
lipgloss.NewStyle().
Width(50).
Align(lipgloss.Center).
Foreground(lipgloss.Color(Red)).
Background(lipgloss.Color(BgColor)).
Render(errorMessage))))
}

0 comments on commit 2e1122c

Please sign in to comment.