Skip to content

Commit 8ee18c3

Browse files
committed
style: add mx-5 to divider to avoid wide growth
1 parent 82b5f05 commit 8ee18c3

2 files changed

Lines changed: 43 additions & 26 deletions

File tree

src/authz-module/components/AuthZTitle.tsx

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Link } from 'react-router-dom';
55
import {
66
Breadcrumb, Col, Container, Row, Button, Badge,
77
Stack,
8+
useMediaQuery,
9+
breakpoints,
810
} from '@openedx/paragon';
911

1012
interface BreadcrumbLink {
@@ -37,23 +39,25 @@ export const ActionButton = ({ label, icon, onClick }: Action) => (
3739

3840
const AuthZTitle = ({
3941
activeLabel, navLinks = [], pageTitle, pageSubtitle, actions = [],
40-
}: AuthZTitleProps) => (
41-
<Container className="p-5 bg-light-100">
42-
<Breadcrumb
43-
linkAs={Link}
44-
links={navLinks}
45-
activeLabel={activeLabel}
46-
/>
47-
<Row className="mt-4">
48-
<Col xs={12} md={7} className="mb-4">
49-
<h1 className="text-primary">{pageTitle}</h1>
50-
{typeof pageSubtitle === 'string'
51-
? <h3><Badge className="py-2 px-3 font-weight-normal" variant="light">{pageSubtitle}</Badge></h3>
52-
: pageSubtitle}
53-
</Col>
54-
<Col xs={12} md={5}>
55-
<Stack gap={3} direction="horizontal">
56-
{
42+
}: AuthZTitleProps) => {
43+
const isDesktop = useMediaQuery({ minWidth: breakpoints.large.minWidth });
44+
return (
45+
<Container className="p-5 bg-light-100">
46+
<Breadcrumb
47+
linkAs={Link}
48+
links={navLinks}
49+
activeLabel={activeLabel}
50+
/>
51+
<Row className="mt-4">
52+
<Col xs={12} md={7} className="mb-4">
53+
<h1 className="text-primary">{pageTitle}</h1>
54+
{typeof pageSubtitle === 'string'
55+
? <h3><Badge className="py-2 px-3 font-weight-normal" variant="light">{pageSubtitle}</Badge></h3>
56+
: pageSubtitle}
57+
</Col>
58+
<Col xs={12} md={5}>
59+
<Stack className="justify-content-end" direction={isDesktop ? 'horizontal' : 'vertical'}>
60+
{
5761
actions.map((action, index) => {
5862
const content = isValidElement(action)
5963
? action
@@ -65,15 +69,16 @@ const AuthZTitle = ({
6569
<Fragment key={`authz-header-action-${key}`}>
6670
{content}
6771
{(index === actions.length - 1) ? null
68-
: (<hr className="border-right" />)}
72+
: (<hr className="mx-lg-5" />)}
6973
</Fragment>
7074
);
7175
})
7276
}
73-
</Stack>
74-
</Col>
75-
</Row>
76-
</Container>
77-
);
77+
</Stack>
78+
</Col>
79+
</Row>
80+
</Container>
81+
);
82+
};
7883

7984
export default AuthZTitle;

src/authz-module/index.scss

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1+
@use "@openedx/paragon/styles/css/core/custom-media-breakpoints" as paragonCustomMediaBreakpoints;
2+
13
.authz-libraries {
2-
--height-action-devider: 30px;
4+
--height-action-divider: 30px;
35

46
.pgn__breadcrumb li:first-child a {
57
color: var(--pgn-color-breadcrumb-active);
68
text-decoration: none;
79
}
10+
811
hr {
9-
height: var(--height-action-devider);
12+
border-top: var(--pgn-size-border-width) solid var(--pgn-color-border);
13+
width: 100%;
14+
}
15+
16+
@media (--pgn-size-breakpoint-min-width-lg) {
17+
hr {
18+
border-right: var(--pgn-size-border-width) solid var(--pgn-color-border);
19+
height: var(--height-action-divider);
20+
width: 0;
21+
}
1022
}
1123

1224
.tab-content {
@@ -53,4 +65,4 @@
5365
// Move toast to the right
5466
left: auto;
5567
right: var(--pgn-spacing-toast-container-gutter-lg);
56-
}
68+
}

0 commit comments

Comments
 (0)