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 {
|
||||
outerWidth := max(width-2, 1)
|
||||
innerWidth := max(outerWidth-2, 1)
|
||||
innerHeight := max(height-1, 1)
|
||||
|
||||
header := lipgloss.NewStyle().
|
||||
Width(innerWidth).
|
||||
Padding(0, 1).
|
||||
Background(palette.PanelInactive).
|
||||
Foreground(palette.FooterKey).
|
||||
Bold(true).
|
||||
Render("CONTENT")
|
||||
innerHeight := max(height, 1)
|
||||
|
||||
body := lipgloss.NewStyle().
|
||||
Width(innerWidth).
|
||||
Height(max(innerHeight-lipgloss.Height(header), 1)).
|
||||
Height(max(innerHeight, 1)).
|
||||
Padding(0, 1).
|
||||
Background(palette.Panel).
|
||||
Render(viewportModel.View())
|
||||
|
|
@ -1613,7 +1605,7 @@ func renderPreviewContent(viewportModel *viewport.Model, palette theme.Palette,
|
|||
BorderTop(true).
|
||||
BorderForeground(palette.Border).
|
||||
BorderBackground(palette.Panel).
|
||||
Render(lipgloss.JoinVertical(lipgloss.Left, header, body))
|
||||
Render(body)
|
||||
}
|
||||
|
||||
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 {
|
||||
label := strings.ToUpper(string(pane.ID))
|
||||
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(" ")
|
||||
pathWidth := max(width, 4)
|
||||
pathStyle := lipgloss.NewStyle().
|
||||
Width(pathWidth).
|
||||
Background(headerBg).
|
||||
Foreground(palette.Text).
|
||||
Bold(active)
|
||||
if active {
|
||||
pathStyle = pathStyle.Foreground(palette.TextFile)
|
||||
}
|
||||
|
||||
return lipgloss.NewStyle().
|
||||
Width(width).
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue