View renders the component.
()
| 940 | |
| 941 | // View renders the component. |
| 942 | func (m Model) View() string { |
| 943 | var ( |
| 944 | sections []string |
| 945 | availHeight = m.height |
| 946 | ) |
| 947 | |
| 948 | if m.showTitle || (m.showFilter && m.filteringEnabled) { |
| 949 | v := m.titleView() |
| 950 | sections = append(sections, v) |
| 951 | availHeight -= lipgloss.Height(v) |
| 952 | } |
| 953 | |
| 954 | if m.showStatusBar { |
| 955 | v := m.statusView() |
| 956 | sections = append(sections, v) |
| 957 | availHeight -= lipgloss.Height(v) |
| 958 | } |
| 959 | |
| 960 | var pagination string |
| 961 | if m.showPagination { |
| 962 | pagination = m.paginationView() |
| 963 | availHeight -= lipgloss.Height(pagination) |
| 964 | } |
| 965 | |
| 966 | var help string |
| 967 | if m.showHelp { |
| 968 | help = m.helpView() |
| 969 | availHeight -= lipgloss.Height(help) |
| 970 | } |
| 971 | |
| 972 | content := lipgloss.NewStyle().Height(availHeight).Render(m.populatedView()) |
| 973 | sections = append(sections, content) |
| 974 | |
| 975 | if m.showPagination { |
| 976 | sections = append(sections, pagination) |
| 977 | } |
| 978 | |
| 979 | if m.showHelp { |
| 980 | sections = append(sections, help) |
| 981 | } |
| 982 | |
| 983 | return lipgloss.JoinVertical(lipgloss.Left, sections...) |
| 984 | } |
| 985 | |
| 986 | func (m Model) titleView() string { |
| 987 | var ( |
no test coverage detected