8000 Fix card header margins by ahuang11 · Pull Request #6639 · holoviz/panel · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions panel/models/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import type * as p from "@bokehjs/core/properties"

import card_css from "styles/models/card.css"

const CHEVRON_RIGHT = `
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"><path stroke="none" d="M0 0h12v12H0z" fill="none"/><path d="M9 6l6 6l-6 6" /></svg>
`

const CHEVRON_DOWN = `
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"><path stroke="none" d="M0 0h12v12H0z" fill="none"/><path d="M6 9l6 6l6 -6" /></svg>
`

export class CardView extends ColumnView {
declare model: Card

Expand Down Expand Up @@ -73,7 +81,7 @@ export class CardView extends ColumnView {
if (this.model.collapsible) {
this.button_el = DOM.createElement("button", {type: "button", class: header_css_classes})
const icon = DOM.createElement("div", {class: button_css_classes})
icon.innerHTML = this.model.collapsed ? "\u25ba" : "\u25bc"
icon.innerHTML = this.model.collapsed ? CHEVRON_RIGHT : CHEVRON_DOWN
this.button_el.appendChild(icon)
this.button_el.style.backgroundColor = header_background != null ? header_background : ""
header.el.style.backgroundColor = header_background != null ? header_background : ""
Expand Down Expand Up @@ -136,7 +144,7 @@ export class CardView extends ColumnView {
} else {
this.collapsed_style.clear()
}
this.button_el.children[0].innerHTML = this.model.collapsed ? "\u25ba" : "\u25bc"
this.button_el.children[0].innerHTML = this.model.collapsed ? CHEVRON_RIGHT : CHEVRON_DOWN
this.invalidate_layout()
}

Expand Down
9 changes: 3 additions & 6 deletions panel/styles/models/card.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
border-radius: 0.25rem;
display: inline-flex;
justify-content: start;
left: 0;
outline: unset;
position: sticky;
width: 100%;
padding-inline: 0.5em;
}

.accordion-header {
Expand All @@ -37,20 +37,17 @@
display: flex;
justify-content: start;
position: sticky;
left: 0;
width: 100%;
}

.card-button {
background-color: transparent;
margin-left: 0.5em;
margin-right: 0.5em;
margin-left: 0em;
margin-right: 0.25em;
}

.card-header-row {
margin-left: auto 1em;
position: relative !important;
max-width: calc(100% - 2em);
}

.card-title {
Expand Down
8 changes: 0 additions & 8 deletions panel/theme/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ button.accordion-header {
border-radius: 0;
}

:host(.card-header-row) .card-title {
margin: 0;
}

.card-header > .card-header-row {
margin-left: 15px;
}

:host(.card-title) h1,
:host(.card-title) h2,
:host(.card-title) h3,
Expand Down
4 changes: 0 additions & 4 deletions panel/theme/css/material.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
padding: 0px 6px;
}

.card-header > .card-header-row {
margin-left: 15px;
}

button.mdc-button.mdc-card-button {
color: transparent;
height: 50px;
Expand Down
0