Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit de0530d

Browse files
committed
add missing label attributes (closes #33)
1 parent d2b3ce4 commit de0530d

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

src/components/CommentUser.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import NextLink from 'next/link';
22
import { Avatar, Link, makeStyles } from '@material-ui/core';
33
import { Profile } from '@zoonk/models';
44
import ProfileSocial from './ProfileSocial';
5+
import useTranslation from './useTranslation';
56

67
interface CommentUserProps {
78
user: Profile.Response;
@@ -16,11 +17,12 @@ const useStyles = makeStyles((theme) => ({
1617
const CommentUser = ({ user }: CommentUserProps) => {
1718
const { name, photo, username } = user;
1819
const classes = useStyles();
20+
const translate = useTranslation();
1921

2022
return (
2123
<div className={classes.root}>
2224
<NextLink href="/profile/[id]" as={`/profile/${username}`} passHref>
23-
<a>
25+
<a aria-label={translate('open_page', { title: name })}>
2426
<Avatar
2527
src={photo || undefined}
2628
alt={name}

src/components/LinkCard.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ import {
66
Typography,
77
} from '@material-ui/core';
88
import { isInternal, theme } from '@zoonk/utils';
9+
import useTranslation from './useTranslation';
910

1011
interface LinkCardProps {
1112
site: Post.Link;
1213
}
1314

1415
const LinkCard = ({ site }: LinkCardProps) => {
16+
const translate = useTranslation();
1517
const { description, image, title, url } = site;
1618

1719
return (
1820
<Card variant="outlined">
1921
<CardActionArea
22+
aria-label={translate('open_page', { title })}
2023
component="a"
2124
href={url}
2225
target={isInternal(url) ? '_self' : '_blank'}

src/components/PostListItem.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Link, makeStyles, Paper, Typography } from '@material-ui/core';
55
import { getDomainFromUrl, isInternal } from '@zoonk/utils';
66
import PostListMeta from './PostListMeta';
77
import { getPlainText, getPostImage } from './rich-text/posts';
8+
import useTranslation from './useTranslation';
89

910
const useStyles = makeStyles((theme) => ({
1011
content: {
@@ -31,6 +32,7 @@ interface PostListItemProps {
3132

3233
const PostListItem = ({ item }: PostListItemProps) => {
3334
const classes = useStyles();
35+
const translate = useTranslation();
3436
const { content, cover, id, sites, title } = item;
3537
const siteImg = sites.find((site) => Boolean(site.image));
3638
const image = cover || getPostImage(content) || siteImg?.image;
@@ -42,6 +44,7 @@ const PostListItem = ({ item }: PostListItemProps) => {
4244
<NextLink href="/posts/[id]" as={`/posts/${id}`} passHref>
4345
<a
4446
className={classes.image}
47+
aria-label={translate('open_page', { title })}
4548
style={{
4649
background: `url(${image}) no-repeat center center`,
4750
backgroundSize: 'cover',

src/locale/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ const translate: TranslationFn = (key, args) => {
159159
no_chapters: `Chapters have lessons for teaching a topic. Help more people learn about ${args?.title}.`,
160160
no_lessons: `Help others to learn about ${args?.title}.`,
161161
notifications: 'Notifications',
162+
open_page: `Open page: ${args?.title}`,
162163
order: 'Order',
163164
page_edits: 'Page changes',
164165
page_edits_title: 'Page changes for:',

src/locale/pt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ const translate: TranslationFn = (key, args) => {
161161
no_chapters: `Os capítulos têm aulas para ensinar um assunto. Ajude mais pessoas a aprenderem sobre ${args?.title}.`,
162162
no_lessons: `Ajude outras pessoas a aprenderem sobre ${args?.title}.`,
163163
notifications: 'Notificações',
164+
open_page: `Abrir página: ${args?.title}`,
164165
order: 'Ordem',
165166
page_edits_title: 'Alterações na página:',
166167
page_edits: 'Alterações na página',

src/models/i18n.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export type TranslationKeys =
156156
| 'no_chapters'
157157
| 'no_lessons'
158158
| 'notifications'
159+
| 'open_page'
159160
| 'order'
160161
| 'page_edits_title'
161162
| 'page_edits'

0 commit comments

Comments
 (0)