Polish panel headers and preview pane chrome
This commit is contained in:
parent
544511f00e
commit
deeb261b89
2 changed files with 8 additions and 28 deletions
|
|
@ -1588,19 +1588,11 @@ func overlayCenter(base string, overlay string, width int) string {
|
||||||
func renderPreviewContent(viewportModel *viewport.Model, palette theme.Palette, width int, height int) string {
|
func renderPreviewContent(viewportModel *viewport.Model, palette theme.Palette, width int, height int) string {
|
||||||
outerWidth := max(width-2, 1)
|
outerWidth := max(width-2, 1)
|
||||||
innerWidth := max(outerWidth-2, 1)
|
innerWidth := max(outerWidth-2, 1)
|
||||||
innerHeight := max(height-1, 1)
|
innerHeight := max(height, 1)
|
||||||
|
|
||||||
header := lipgloss.NewStyle().
|
|
||||||
Width(innerWidth).
|
|
||||||
Padding(0, 1).
|
|
||||||
Background(palette.PanelInactive).
|
|
||||||
Foreground(palette.FooterKey).
|
|
||||||
Bold(true).
|
|
||||||
Render("CONTENT")
|
|
||||||
|
|
||||||
body := lipgloss.NewStyle().
|
body := lipgloss.NewStyle().
|
||||||
Width(innerWidth).
|
Width(innerWidth).
|
||||||
Height(max(innerHeight-lipgloss.Height(header), 1)).
|
Height(max(innerHeight, 1)).
|
||||||
Padding(0, 1).
|
Padding(0, 1).
|
||||||
Background(palette.Panel).
|
Background(palette.Panel).
|
||||||
Render(viewportModel.View())
|
Render(viewportModel.View())
|
||||||
|
|
@ -1613,7 +1605,7 @@ func renderPreviewContent(viewportModel *viewport.Model, palette theme.Palette,
|
||||||
BorderTop(true).
|
BorderTop(true).
|
||||||
BorderForeground(palette.Border).
|
BorderForeground(palette.Border).
|
||||||
BorderBackground(palette.Panel).
|
BorderBackground(palette.Panel).
|
||||||
Render(lipgloss.JoinVertical(lipgloss.Left, header, body))
|
Render(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
func previewIcon(preview vfs.Preview) string {
|
func previewIcon(preview vfs.Preview) string {
|
||||||
|
|
|
||||||
|
|
@ -137,32 +137,20 @@ func renderPane(
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderPaneHeader(pane BrowserPane, cfg config.Config, palette theme.Palette, width int, active bool, headerBg lipgloss.Color) string {
|
func renderPaneHeader(pane BrowserPane, cfg config.Config, palette theme.Palette, width int, active bool, headerBg lipgloss.Color) string {
|
||||||
label := strings.ToUpper(string(pane.ID))
|
pathWidth := max(width, 4)
|
||||||
labelStyle := lipgloss.NewStyle().
|
|
||||||
Foreground(palette.Background).
|
|
||||||
Background(palette.FooterKey).
|
|
||||||
Bold(true).
|
|
||||||
Padding(0, 1)
|
|
||||||
if active {
|
|
||||||
labelStyle = labelStyle.Background(palette.Accent)
|
|
||||||
}
|
|
||||||
|
|
||||||
labelView := labelStyle.Render(label)
|
|
||||||
pathWidth := max(width-lipgloss.Width(labelView)-1, 4)
|
|
||||||
spacer := lipgloss.NewStyle().
|
|
||||||
Width(1).
|
|
||||||
Background(headerBg).
|
|
||||||
Render(" ")
|
|
||||||
pathStyle := lipgloss.NewStyle().
|
pathStyle := lipgloss.NewStyle().
|
||||||
Width(pathWidth).
|
Width(pathWidth).
|
||||||
Background(headerBg).
|
Background(headerBg).
|
||||||
Foreground(palette.Text).
|
Foreground(palette.Text).
|
||||||
Bold(active)
|
Bold(active)
|
||||||
|
if active {
|
||||||
|
pathStyle = pathStyle.Foreground(palette.TextFile)
|
||||||
|
}
|
||||||
|
|
||||||
return lipgloss.NewStyle().
|
return lipgloss.NewStyle().
|
||||||
Width(width).
|
Width(width).
|
||||||
Background(headerBg).
|
Background(headerBg).
|
||||||
Render(labelView + spacer + pathStyle.Render(truncateMiddle(compactPath(pane.Path, cfg.UI.PathDisplay), pathWidth)))
|
Render(pathStyle.Render(truncateMiddle(compactPath(pane.Path, cfg.UI.PathDisplay), pathWidth)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderColumnsHeader(cfg config.Config, width int, palette theme.Palette, background lipgloss.Color) string {
|
func renderColumnsHeader(cfg config.Config, width int, palette theme.Palette, background lipgloss.Color) string {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue