Skip to content

Commit 6c743f8

Browse files
authored
fix: video selection gallery scroll (#477)
* fix: video selection gallery scroll * fix: lint errors
1 parent 3315205 commit 6c743f8

File tree

11 files changed

+69
-115
lines changed

11 files changed

+69
-115
lines changed

src/editors/containers/VideoEditor/components/BaseModal.jsx

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/editors/containers/VideoEditor/components/SelectVideoModal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
55
import { Button } from '@openedx/paragon';
66

77
import { thunkActions } from '../../../data/redux';
8-
import BaseModal from './BaseModal';
8+
import BaseModal from '../../../sharedComponents/BaseModal';
99
import * as module from './SelectVideoModal';
1010

1111
export const hooks = {

src/editors/containers/VideoGallery/index.jsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,30 @@ export const VideoGallery = () => {
5656
);
5757

5858
return (
59-
<SelectionModal
60-
{...{
61-
isOpen: true,
62-
close: handleCancel,
63-
size: 'fullscreen',
64-
isFullscreenScroll: false,
65-
galleryError,
66-
inputError,
67-
fileInput,
68-
galleryProps: {
69-
...galleryProps,
70-
thumbnailFallback,
71-
},
72-
searchSortProps,
73-
selectBtnProps,
74-
acceptedFiles: acceptedImgKeys,
75-
modalMessages,
76-
isLoaded,
77-
isUploadError,
78-
isFetchError,
79-
}}
80-
/>
59+
<div style={isLoaded ? { backgroundColor: '#E9E6E4' } : {}}>
60+
<SelectionModal
61+
{...{
62+
isOpen: true,
63+
close: handleCancel,
64+
size: 'fullscreen',
65+
isFullscreenScroll: false,
66+
galleryError,
67+
inputError,
68+
fileInput,
69+
galleryProps: {
70+
...galleryProps,
71+
thumbnailFallback,
72+
},
73+
searchSortProps,
74+
selectBtnProps,
75+
acceptedFiles: acceptedImgKeys,
76+
modalMessages,
77+
isLoaded,
78+
isUploadError,
79+
isFetchError,
80+
}}
81+
/>
82+
</div>
8183
);
8284
};
8385

src/editors/sharedComponents/BaseModal/__snapshots__/index.test.jsx.snap

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ exports[`BaseModal ImageUploadModal template component snapshot 1`] = `
2323
props.title node
2424
</ModalDialog.Title>
2525
</ModalDialog.Header>
26-
<ModalDialog.Body
26+
<Scrollable
2727
style={null}
2828
>
29-
props.children node
30-
</ModalDialog.Body>
29+
<ModalDialog.Body>
30+
props.children node
31+
</ModalDialog.Body>
32+
</Scrollable>
3133
<ModalDialog.Footer>
3234
<ActionRow>
3335
props.footerAction node

src/editors/sharedComponents/BaseModal/index.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
44
import {
55
ActionRow,
66
ModalDialog,
7+
Scrollable,
78
} from '@openedx/paragon';
89
import { FormattedMessage } from '@edx/frontend-platform/i18n';
910

@@ -39,9 +40,11 @@ export const BaseModal = ({
3940
</ModalDialog.Title>
4041
{headerComponent}
4142
</ModalDialog.Header>
42-
<ModalDialog.Body style={bodyStyle}>
43-
{children}
44-
</ModalDialog.Body>
43+
<Scrollable style={bodyStyle}>
44+
<ModalDialog.Body>
45+
{children}
46+
</ModalDialog.Body>
47+
</Scrollable>
4548
<ModalDialog.Footer>
4649
<ActionRow>
4750
{footerAction}

src/editors/sharedComponents/SelectionModal/Gallery.jsx

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
import {
5-
Scrollable, Spinner,
6-
} from '@openedx/paragon';
4+
import { Spinner } from '@openedx/paragon';
75
import {
86
FormattedMessage,
97
useIntl,
@@ -59,26 +57,24 @@ export const Gallery = ({
5957
);
6058
}
6159
return (
62-
<Scrollable className="gallery bg-light-400" style={{ height, margin: '0 -1.5rem' }}>
63-
<div className="p-4">
64-
<SelectableBox.Set
65-
columns={1}
66-
name="images"
67-
onChange={onHighlightChange}
68-
type="radio"
69-
value={highlighted}
70-
>
71-
{ displayList.map(asset => (
72-
<GalleryCard
73-
key={asset.id}
74-
asset={asset}
75-
showId={showIdsOnCards}
76-
thumbnailFallback={thumbnailFallback}
77-
/>
78-
)) }
79-
</SelectableBox.Set>
80-
</div>
81-
</Scrollable>
60+
<div className="p-4 gallery bg-light-400" style={{ height, margin: '0 -1.5rem' }}>
61+
<SelectableBox.Set
62+
columns={1}
63+
name="images"
64+
onChange={onHighlightChange}
65+
type="radio"
66+
value={highlighted}
67+
>
68+
{ displayList.map(asset => (
69+
<GalleryCard
70+
key={asset.id}
71+
asset={asset}
72+
showId={showIdsOnCards}
73+
thumbnailFallback={thumbnailFallback}
74+
/>
75+
)) }
76+
</SelectableBox.Set>
77+
</div>
8278
);
8379
};
8480

src/editors/sharedComponents/SelectionModal/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const SelectionModal = ({
8181
</Button>
8282
)}
8383
title={intl.formatMessage(titleMsg)}
84-
bodyStyle={{ background, padding: '3px 24px' }}
84+
bodyStyle={{ background }}
8585
headerComponent={(
8686
<div style={{ margin: '18px 0' }}>
8787
<SearchSort {...searchSortProps} />

src/editors/sharedComponents/SelectionModal/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222

2323
/* Set top padding to 0 when there is an alert above. */
24-
.selection-modal .pgn__vstack > .alert + .gallery > .pgn__scrollable-body-content > .p-4 {
24+
.selection-modal .pgn__scrollable-body-content > .pgn__vstack > .alert + .gallery > .p-4 {
2525
padding-top: 0 !important;
2626
}
2727

src/editors/sharedComponents/SourceCodeModal/__snapshots__/index.test.jsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
exports[`SourceCodeModal renders as expected with default behavior 1`] = `
44
<BaseModal
5-
bodyStyle={null}
5+
bodyStyle={
6+
Object {
7+
"maxHeight": NaN,
8+
}
9+
}
610
close={[MockFunction]}
711
confirmAction={
812
<Button
@@ -32,11 +36,7 @@ exports[`SourceCodeModal renders as expected with default behavior 1`] = `
3236
title="Edit Source Code"
3337
>
3438
<div
35-
style={
36-
Object {
37-
"padding": "10px 30px",
38-
}
39-
}
39+
className="px-4.5 pt-2.5"
4040
>
4141
<injectIntl(ShimmedIntlComponent)
4242
innerRef="moCKrEf"

src/editors/sharedComponents/SourceCodeModal/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
intlShape,
88
} from '@edx/frontend-platform/i18n';
99

10-
import { Button } from '@openedx/paragon';
10+
import { Button, useWindowSize } from '@openedx/paragon';
1111
import messages from './messages';
1212
import hooks from './hooks';
1313
import BaseModal from '../BaseModal';
@@ -22,6 +22,8 @@ export const SourceCodeModal = ({
2222
intl,
2323
}) => {
2424
const { saveBtnProps, value, ref } = hooks.prepareSourceCodeModal({ editorRef, close });
25+
const { height } = useWindowSize();
26+
2527
return (
2628
<BaseModal
2729
close={close}
@@ -33,8 +35,9 @@ export const SourceCodeModal = ({
3335
)}
3436
isOpen={isOpen}
3537
title={intl.formatMessage(messages.titleLabel)}
38+
bodyStyle={{ maxHeight: (height - 180) }}
3639
>
37-
<div style={{ padding: '10px 30px' }}>
40+
<div className="px-4.5 pt-2.5">
3841
<CodeEditor
3942
innerRef={ref}
4043
value={value}

0 commit comments

Comments
 (0)