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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pages/docs/viewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,12 @@ The information panel is a collapsible panel that displays information about the
| `options.informationPanel.renderToggle` | `boolean` | No | true |
| `options.informationPanel.renderContentSearch` | `boolean` | No | true |
| `options.informationPanel.defaultTab` | `string` | No | |
| `options.informationPanel.tabLayout` | `string` | No | stack |

If `renderAbout` is true, Clover will use the About tab as the default tab. Use `options.informationPanel.defaultTab` to set the default tab.

The `tabLayout` option can be set to either `row` or `stack` to lay out the tabs as necessary.

If you want content search to be the default tab, use `manifest-content-search`

```jsx
Expand All @@ -220,6 +223,7 @@ If you want content search to be the default tab, use `manifest-content-search`
options={{
informationPanel: {
defaultTab: "manifest-content-search",
tabLayout: "stack",
},
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const Wrapper = styled(Tabs.Root, {

const List = styled(Tabs.List, {
display: "flex",
flexDirection: "var(--flex-direction)",
flexWrap: "var(--flex-wrap)",
justifyContent: "var(--justify-content)",
flexGrow: "0",
margin: "0 1.618rem",
borderBottom: "4px solid #6663",
Expand Down
23 changes: 23 additions & 0 deletions src/components/Viewer/InformationPanel/InformationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const InformationPanel: React.FC<NavigatorProps> = ({
const { informationPanel } = configOptions;

const [activeResource, setActiveResource] = useState<string>();
const [tabLayout, setTabLayout] = useState<Record<string, string>>();

const renderAbout = informationPanel?.renderAbout;
const renderAnnotation = informationPanel?.renderAnnotation;
Expand Down Expand Up @@ -160,6 +161,27 @@ export const InformationPanel: React.FC<NavigatorProps> = ({
setActiveResource(value);
};

useEffect(() => {
if (informationPanel && informationPanel.tabLayout) {
let displaySettings = {};
switch (informationPanel.tabLayout) {
case "row":
displaySettings = {
"--flex-direction": "row",
"--flex-wrap": "wrap",
"--justify-content": "space-between",
};
break;
default:
displaySettings = {
"--flex-direction": "column",
};
break;
}
setTabLayout(displaySettings);
}
}, [informationPanel]);

return (
<Wrapper
data-testid="information-panel"
Expand All @@ -172,6 +194,7 @@ export const InformationPanel: React.FC<NavigatorProps> = ({
<List
aria-label={t("informationPanelTabs")}
data-testid="information-panel-list"
css={tabLayout}
>
{renderToggle && (
<Trigger
Expand Down
2 changes: 2 additions & 0 deletions src/context/viewer-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type ViewerConfigOptions = {
autoScroll?: AutoScrollOptions | AutoScrollSettings | boolean;
};
renderContentSearch?: boolean;
tabLayout?: string;
defaultTab?: string;
};
openSeadragon?: OpenSeadragonOptions;
Expand Down Expand Up @@ -117,6 +118,7 @@ const defaultConfigOptions = {
renderToggle: true,
renderAnnotation: true,
renderContentSearch: true,
tabLayout: "stack",
},
openSeadragon: {},
requestHeaders: { "Content-Type": "application/json" },
Expand Down