diff --git a/src/components/ChangelogDialog/ChangelogDialog.scss b/src/components/ChangelogDialog/ChangelogDialog.scss index 74ddd458..e7c8694e 100644 --- a/src/components/ChangelogDialog/ChangelogDialog.scss +++ b/src/components/ChangelogDialog/ChangelogDialog.scss @@ -7,13 +7,10 @@ $maxItemsHeight: 70vh; --gc-changelog-dialog-max-height: #{$maxItemsHeight}; --gc-changelog-dialog-meta-width: 80px; - // `--gc-changelog-dialog-width` is deprecated in favor of `--gc-changelog-dialog-max-width` + // `--gc-changelog-dialog-width` is deprecated in favor of `--g-modal-max-width` &__modal { --g-modal-width: 100%; - --g-modal-max-width: var( - --gc-changelog-dialog-max-width, - var(--gc-changelog-dialog-width, 732px) - ); + --g-modal-max-width: var(--gc-changelog-dialog-width, 732px); } &__full-list-link-icon { diff --git a/src/components/ChangelogDialog/ChangelogDialog.tsx b/src/components/ChangelogDialog/ChangelogDialog.tsx index 580e6215..e79e4b6c 100644 --- a/src/components/ChangelogDialog/ChangelogDialog.tsx +++ b/src/components/ChangelogDialog/ChangelogDialog.tsx @@ -30,6 +30,7 @@ export interface ChangelogDialogProps { error?: boolean | {title: string; description: string}; disableHeightTransition?: boolean; className?: string; + modalClassName?: string; } let nextId = 1; @@ -55,6 +56,7 @@ export function ChangelogDialog(props: ChangelogDialogProps) { loading, error, className, + modalClassName, } = props; const idRef = React.useRef(undefined); @@ -64,7 +66,7 @@ export function ChangelogDialog(props: ChangelogDialogProps) { return ( = (props: ChangelogDialogProps) => ( + + + + +); + +export const CustomMaxWidth = CustomMaxWidthTemplate.bind({}); +CustomMaxWidth.args = { + ...Default.args, +}; diff --git a/src/components/ChangelogDialog/__tests__/ChangelogDialog.test.tsx b/src/components/ChangelogDialog/__tests__/ChangelogDialog.test.tsx index 41d8771b..9b2dec73 100644 --- a/src/components/ChangelogDialog/__tests__/ChangelogDialog.test.tsx +++ b/src/components/ChangelogDialog/__tests__/ChangelogDialog.test.tsx @@ -124,7 +124,7 @@ test('Calls onStoryClick and onLinkClick', async () => { expect(handleLinkClick).toBeCalledWith('https://example.com'); }); -test('Applies className to the element the size CSS variables are set on', () => { +test('Applies className to the dialog', () => { const {baseElement} = render( , ); @@ -132,3 +132,12 @@ test('Applies className to the element the size CSS variables are set on', () => // eslint-disable-next-line testing-library/no-node-access expect(baseElement.querySelector('.gc-changelog-dialog')).toHaveClass('custom-class'); }); + +test('Applies modalClassName to the element the size CSS variables are read on', () => { + const {baseElement} = render( + , + ); + + // eslint-disable-next-line testing-library/no-node-access + expect(baseElement.querySelector('.gc-changelog-dialog__modal')).toHaveClass('custom-class'); +});