Skip to content

Commit 7f79ac3

Browse files
authored
poc: add Panel styles (#6589)
* poc: add `Panel` styles * poc: add `Panel` footer * fix: conditional footer * fix: make header optional
1 parent 64edd48 commit 7f79ac3

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

examples/react/css/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function App() {
4545
</header>
4646
<div className="container two-columns">
4747
<div className="left-column">
48-
<Panel header="categories">
48+
<Panel header="categories" footer="This is a footer">
4949
<HierarchicalMenu
5050
attributes={[
5151
'hierarchicalCategories.lvl0',

examples/react/css/src/Panel.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import React from 'react';
22

33
type PanelProps = React.PropsWithChildren<{
4-
header: string;
4+
header?: React.ReactNode;
5+
footer?: React.ReactNode;
56
}>;
67

7-
export function Panel({ header, children }: PanelProps) {
8+
export function Panel({ header, children, footer }: PanelProps) {
89
return (
910
<div className="ais-Panel">
10-
<div className="ais-Panel-header">
11-
<span>{header}</span>
12-
</div>
11+
{Boolean(header) && (
12+
<div className="ais-Panel-header">
13+
<span>{header}</span>
14+
</div>
15+
)}
1316
<div className="ais-Panel-body">{children}</div>
17+
{Boolean(footer) && <div className="ais-Panel-footer">{footer}</div>}
1418
</div>
1519
);
1620
}

examples/react/css/src/algolia.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
@import url('searchbox.css');
88
@import url('hierarchical-menu.css');
99
@import url('refinement-list.css');
10+
@import url('panel.css');

examples/react/css/src/panel.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.ais-Panel-header {
2+
display: flex;
3+
align-items: center;
4+
padding: var(--ais-spacing);
5+
border-bottom: 1px solid
6+
rgba(var(--ais-border-color-rgb), var(--ais-border-color-alpha));
7+
margin-bottom: var(--ais-spacing);
8+
font-weight: var(--ais-font-weight-medium);
9+
text-transform: capitalize;
10+
}
11+
12+
.ais-Panel-footer {
13+
margin-top: calc(var(--ais-spacing) * 0.5);
14+
font-size: 0.9em;
15+
}

0 commit comments

Comments
 (0)