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

(feat) Allow passing action menu state to the workspace container #1189

Merged
merged 2 commits into from
Oct 29, 2024
Merged
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
2 changes: 1 addition & 1 deletion packages/framework/esm-framework/docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -5832,7 +5832,7 @@ This component also provides everything needed for workspace notifications to be

#### Defined in

[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:67](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L67)
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:68](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L68)

___

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@

### Properties

- [actionMenuProps](WorkspaceContainerProps.md#actionmenuprops)
- [additionalWorkspaceProps](WorkspaceContainerProps.md#additionalworkspaceprops)
- [contextKey](WorkspaceContainerProps.md#contextkey)
- [overlay](WorkspaceContainerProps.md#overlay)
- [showSiderailAndBottomNav](WorkspaceContainerProps.md#showsiderailandbottomnav)

## Properties

### actionMenuProps

• `Optional` **actionMenuProps**: `Record`<`string`, `unknown`\>

#### Defined in

[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:20](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L20)

___

### additionalWorkspaceProps

• `Optional` **additionalWorkspaceProps**: `object`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import styles from './action-menu.module.scss';
export interface ActionMenuProps {
isWithinWorkspace?: boolean;
name?: string;
actionMenuProps?: Record<string, unknown>;
}

export function ActionMenu({ isWithinWorkspace, name }: ActionMenuProps) {
export function ActionMenu({ isWithinWorkspace, name, actionMenuProps = {} }: ActionMenuProps) {
const [keyboardVisible, setKeyboardVisible] = useState(false);
const initialHeight = useRef(window.innerHeight);
const { featureName } = useContext(ComponentContext);
Expand Down Expand Up @@ -37,7 +38,7 @@ export function ActionMenu({ isWithinWorkspace, name }: ActionMenuProps) {
})}
>
<div className={styles.container}>
<ExtensionSlot className={styles.chartExtensions} name={extensionSlotName} />
<ExtensionSlot className={styles.chartExtensions} name={extensionSlotName} state={actionMenuProps} />
</div>
</aside>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface WorkspaceContainerProps {
overlay?: boolean;
showSiderailAndBottomNav?: boolean;
additionalWorkspaceProps?: object;
actionMenuProps?: Record<string, unknown>;
}

/**
Expand Down Expand Up @@ -69,6 +70,7 @@ export function WorkspaceContainer({
overlay,
showSiderailAndBottomNav,
additionalWorkspaceProps,
actionMenuProps,
}: WorkspaceContainerProps) {
const layout = useLayoutType();
const { workspaces, workspaceWindowState } = useWorkspaces();
Expand Down Expand Up @@ -118,7 +120,7 @@ export function WorkspaceContainer({
</aside>
<WorkspaceNotification contextKey={contextKey} />
</div>
{showSiderailAndBottomNav && <ActionMenu />}
{showSiderailAndBottomNav && <ActionMenu actionMenuProps={actionMenuProps} />}
</>
);
}
Expand Down
Loading