Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adds split panel url params #1593

Merged
merged 1 commit into from
Sep 27, 2023
Merged
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
16 changes: 15 additions & 1 deletion pages/app-layout/with-drawers.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ import {
SplitPanel,
Toggle,
} from '~components';
import { AppLayoutProps } from '~components/app-layout';
import appLayoutLabels from './utils/labels';
import { Breadcrumbs, Containers } from './utils/content-blocks';
import ScreenshotArea from '../utils/screenshot-area';
import type { DrawerItem } from '~components/app-layout/drawer/interfaces';
import AppContext, { AppContextType } from '../app/app-context';

type DemoContext = React.Context<AppContextType<{ hasTools: boolean | undefined; hasDrawers: boolean | undefined }>>;
type DemoContext = React.Context<
AppContextType<{
hasTools: boolean | undefined;
hasDrawers: boolean | undefined;
splitPanelPosition: AppLayoutProps.SplitPanelPreferences['position'];
}>
>;

const getAriaLabels = (title: string, badge: boolean) => {
return {
Expand Down Expand Up @@ -179,6 +186,13 @@ export default function WithDrawers() {
<Containers />
</ContentLayout>
}
splitPanelPreferences={{
position: urlParams.splitPanelPosition,
}}
onSplitPanelPreferencesChange={event => {
const { position } = event.detail;
setUrlParams({ splitPanelPosition: position === 'side' ? position : undefined });
}}
splitPanel={
<SplitPanel
header="Split panel header"
Expand Down
Loading