Skip to content

Commit fc4b700

Browse files
authored
fix: responsiveness on library authoring sidebar (openedx#1293)
* fix: responsiveness on library authoring sidebar * fix: adjust margin to prevent height change * fix: prevent button stretch
1 parent 314dfa6 commit fc4b700

File tree

7 files changed

+20
-31
lines changed

7 files changed

+20
-31
lines changed

src/index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ body {
6161
background-color: $light-100;
6262
}
6363
}
64+
65+
mark {
66+
padding: 0;
67+
}

src/library-authoring/LibraryAuthoringPage.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
.open-border {
88
border: 2px solid;
9+
margin: -1px 0;
910
}
1011
}
1112
}
1213

1314
.library-authoring-sidebar {
14-
min-width: 300px;
15-
max-width: map-get($grid-breakpoints, "sm");
1615
z-index: 1001; // to appear over header
16+
flex: 450px 0 0;
1717
position: sticky;
1818
top: 0;
1919
right: 0;

src/library-authoring/LibraryCollections.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { CardGrid } from '@openedx/paragon';
2-
31
import { useLoadOnScroll } from '../hooks';
42
import { useSearchContext } from '../search-manager';
53
import { NoComponents, NoSearchResults } from './EmptyStates';
@@ -41,22 +39,14 @@ const LibraryCollections = ({ variant }: LibraryCollectionsProps) => {
4139
}
4240

4341
return (
44-
<CardGrid
45-
columnSizes={{
46-
sm: 12,
47-
md: 6,
48-
lg: 4,
49-
xl: 3,
50-
}}
51-
hasEqualColumnHeights
52-
>
42+
<div className="library-cards-grid">
5343
{ collectionList.map((collectionHit) => (
5444
<CollectionCard
5545
key={collectionHit.id}
5646
collectionHit={collectionHit}
5747
/>
5848
)) }
59-
</CardGrid>
49+
</div>
6050
);
6151
};
6252

src/library-authoring/component-info/ComponentInfoHeader.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const ComponentInfoHeader = ({ library, usageKey }: ComponentInfoHeaderProps) =>
6262

6363
return (
6464
<Stack direction="horizontal">
65-
{ inputIsActive
65+
{inputIsActive
6666
? (
6767
<Form.Control
6868
autoFocus
@@ -86,6 +86,7 @@ const ComponentInfoHeader = ({ library, usageKey }: ComponentInfoHeaderProps) =>
8686
iconAs={Icon}
8787
alt={intl.formatMessage(messages.editNameButtonAlt)}
8888
onClick={handleClick}
89+
size="inline"
8990
/>
9091
)}
9192
</>

src/library-authoring/components/ComponentCard.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
.library-component-card {
2-
.pgn__card {
3-
height: 100%;
4-
}
5-
62
.library-component-header {
73
border-top-left-radius: .375rem;
84
border-top-right-radius: .375rem;

src/library-authoring/components/LibraryComponents.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useMemo } from 'react';
2-
import { CardGrid } from '@openedx/paragon';
32

43
import { useLoadOnScroll } from '../../hooks';
54
import { useSearchContext } from '../../search-manager';
@@ -56,23 +55,15 @@ const LibraryComponents = ({ libraryId, variant }: LibraryComponentsProps) => {
5655
}
5756

5857
return (
59-
<CardGrid
60-
columnSizes={{
61-
sm: 12,
62-
md: 6,
63-
lg: 4,
64-
xl: 3,
65-
}}
66-
hasEqualColumnHeights
67-
>
58+
<div className="library-cards-grid">
6859
{ componentList.map((contentHit) => (
6960
<ComponentCard
7061
key={contentHit.id}
7162
contentHit={contentHit}
7263
blockTypeDisplayName={blockTypes[contentHit.blockType]?.displayName ?? ''}
7364
/>
7465
)) }
75-
</CardGrid>
66+
</div>
7667
);
7768
};
7869

src/library-authoring/index.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
@import "./component-info/ComponentPreview";
22
@import "./components/ComponentCard";
33
@import "./generic";
4-
@import "./LibraryAuthoringPage";
4+
@import "./LibraryAuthoringPage";
5+
6+
.library-cards-grid {
7+
display: grid;
8+
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
9+
grid-gap: 2rem;
10+
justify-items: center;
11+
}

0 commit comments

Comments
 (0)