| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { Button } from "@wordpress/components"; |
| 3 |
import { useTableStore } from "../store"; |
| 4 |
|
| 5 |
export function SortPreviewBanner() { |
| 6 |
const sortPreviewMode = useTableStore(state => state.sortPreviewMode); |
| 7 |
const exitSortPreviewMode = useTableStore( |
| 8 |
state => state.exitSortPreviewMode |
| 9 |
); |
| 10 |
|
| 11 |
if (!sortPreviewMode) { |
| 12 |
return null; |
| 13 |
} |
| 14 |
|
| 15 |
return ( |
| 16 |
<div |
| 17 |
style={{ |
| 18 |
display: "flex", |
| 19 |
alignItems: "center", |
| 20 |
justifyContent: "space-between", |
| 21 |
padding: "8px 12px", |
| 22 |
backgroundColor: "#f0f0f1", |
| 23 |
borderBottom: "1px solid #c3c4c7", |
| 24 |
fontSize: "13px", |
| 25 |
}} |
| 26 |
> |
| 27 |
<div style={{ display: "flex", alignItems: "center", gap: "8px" }}> |
| 28 |
<span |
| 29 |
style={{ |
| 30 |
fontWeight: 500, |
| 31 |
color: "#1e1e1e", |
| 32 |
}} |
| 33 |
> |
| 34 |
{__("Sort Preview Mode", "tableberg")} |
| 35 |
</span> |
| 36 |
</div> |
| 37 |
<Button variant="secondary" onClick={exitSortPreviewMode}> |
| 38 |
{__("Exit Sorting Preview", "tableberg")} |
| 39 |
</Button> |
| 40 |
</div> |
| 41 |
); |
| 42 |
} |
| 43 |
|