summaryrefslogtreecommitdiff
path: root/menu/icon.go
blob: ec2135f66d5803f5055b4c0e3e6db27f33fecc81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package menu

import (
	"github.com/charmbracelet/lipgloss"
	"pik/menu/style"
	"strings"
)

var (
	IconStyle = style.New(func() lipgloss.Style {
		st := lipgloss.NewStyle().Width(2).Height(1)
		return st
	})
)

func Icon(input string) string {
	if strings.TrimSpace(input) == "" {
		return ""
	}
	return IconStyle.Render(input)
}

func PaddedIcon(input string) string {
	if strings.TrimSpace(input) == "" {
		return Icon("  ")
	}
	return Icon(input)
}