Skip to content

Commit b73ae54

Browse files
authored
feat(project): add custom menu label to sidebar (#637)
* feat(project): add custom menu label to sidebar * refactor(home): add translated title to aria-label
1 parent adf388c commit b73ae54

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/ui-react/src/containers/ShelfList/ShelfList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const ShelfList = ({ rows }: Props) => {
8787
key={`${index}_${playlist.id}`}
8888
className={classNames(styles.shelfContainer, { [styles.featured]: isFeatured })}
8989
data-testid={testId(`shelf-${isFeatured ? 'featured' : type === 'playlist' ? slugify(translatedTitle) : type}`)}
90-
aria-label={title || playlist?.title}
90+
aria-label={translatedTitle}
9191
>
9292
<Fade duration={250} delay={index * 33} open>
9393
<ShelfComponent

packages/ui-react/src/containers/SidebarContainer/SidebarContainer.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ const SidebarUserActions = ({
4949
};
5050

5151
const SidebarContainer = () => {
52-
const { t } = useTranslation('common');
52+
const { t, i18n } = useTranslation('common');
53+
const language = i18n.language;
5354
const navigate = useNavigate();
5455
const location = useLocation();
5556

@@ -82,9 +83,9 @@ const SidebarContainer = () => {
8283
<li>
8384
<MenuButton label={t('home')} to="/" />
8485
</li>
85-
{menu.map(({ contentId, type, label }) => (
86+
{menu.map(({ contentId, type, label, custom }) => (
8687
<li key={contentId}>
87-
<MenuButton label={label} to={determinePath({ type, contentId })} />
88+
<MenuButton label={custom?.[`label-${language}`] || label} to={determinePath({ type, contentId })} />
8889
</li>
8990
))}
9091
</ul>

0 commit comments

Comments
 (0)