Skip to content

Commit 59cb8e6

Browse files
bugfix: realign breadcrumb in ui (#1469)
Co-authored-by: Kylee Fields <43586156+kyleecodes@users.noreply.github.com>
1 parent 7862cd3 commit 59cb8e6

File tree

1 file changed

+41
-14
lines changed

1 file changed

+41
-14
lines changed

components/session/SessionHeader.tsx

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import illustrationPerson4Peach from '@/public/illustration_person4_peach.svg';
88
import { breadcrumbButtonStyle } from '@/styles/common';
99
import theme from '@/styles/theme';
1010
import CircleIcon from '@mui/icons-material/Circle';
11-
import { Button, Typography, useMediaQuery } from '@mui/material';
11+
import { Box, Button, Typography, useMediaQuery } from '@mui/material';
1212
import { ISbRichtext, ISbStoryData } from '@storyblok/react/rsc';
1313
import { useLocale, useTranslations } from 'next-intl';
1414
import { useEffect, useState } from 'react';
@@ -36,6 +36,7 @@ export const SessionHeader = (props: SessionHeaderProps) => {
3636

3737
const t = useTranslations('Courses');
3838
const locale = useLocale();
39+
3940
const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'));
4041

4142
const [weekString, setWeekString] = useState<string>('');
@@ -69,21 +70,47 @@ export const SessionHeader = (props: SessionHeaderProps) => {
6970
imageAlt={headerProps.imageAlt}
7071
progressStatus={sessionProgress}
7172
>
72-
<Button variant="contained" href="/courses" sx={breadcrumbButtonStyle} size="small">
73-
{t('courses')}
74-
</Button>
73+
<Box
74+
component="nav"
75+
sx={{
76+
display: 'flex',
77+
alignItems: 'center',
78+
flexWrap: isSmallScreen ? 'wrap' : 'nowrap',
79+
overflowX: isSmallScreen ? 'visible' : 'auto',
80+
gap: 1,
81+
}}
82+
>
83+
<Button
84+
size="small"
85+
variant="contained"
86+
href="/courses"
87+
sx={{
88+
...breadcrumbButtonStyle,
89+
whiteSpace: 'nowrap',
90+
}}
91+
>
92+
{t('courses')}
93+
</Button>
7594

76-
<CircleIcon color="error" sx={{ ...dotStyle, marginX: 1 }} />
95+
<CircleIcon color="error" sx={dotStyle} />
96+
97+
<Button
98+
size="small"
99+
variant="contained"
100+
component={i18nLink}
101+
href={getDefaultFullSlug(course.full_slug, locale)}
102+
sx={{
103+
...breadcrumbButtonStyle,
104+
flexShrink: 1,
105+
minWidth: 0,
106+
whiteSpace: isSmallScreen ? 'normal' : 'nowrap',
107+
wordBreak: 'break-word',
108+
}}
109+
>
110+
{courseNameEllipses}
111+
</Button>
112+
</Box>
77113

78-
<Button
79-
variant="contained"
80-
sx={breadcrumbButtonStyle}
81-
href={getDefaultFullSlug(course.full_slug, locale)}
82-
component={i18nLink}
83-
size="small"
84-
>
85-
{courseNameEllipses}
86-
</Button>
87114
<Typography sx={sessionSubtitleStyle} variant="body2">
88115
{weekString} -{' '}
89116
{storyPosition !== undefined ? `${t('session')} ${storyPosition / 10 - 1}` : subtitle}

0 commit comments

Comments
 (0)