Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions src/components/FileContributors.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BaseHTMLAttributes, useState } from "react"
import { Avatar } from "@chakra-ui/react"

import type { ChildOnlyProp, FileContributor } from "@/lib/types"

Expand All @@ -12,6 +11,7 @@ import { ScrollArea } from "@/components/ui/scroll-area"

import { trackCustomEvent } from "@/lib/utils/matomo"

import { Avatar } from "./ui/avatar"
import Modal from "./ui/dialog-modal"

import { useBreakpointValue } from "@/hooks/useBreakpointValue"
Expand All @@ -22,19 +22,27 @@ const ContributorList = ({ children }: Required<ChildOnlyProp>) => (
</ScrollArea>
)

const ContributorAvatar = ({
contributor,
label,
}: ContributorProps & { label?: string }) => (
<Avatar
src={contributor.avatar_url}
name={contributor.login}
href={`https://github.com/${contributor.login}`}
// `size-10` is not part of the "size" variants
className="me-2 size-10"
label={label}
/>
)

type ContributorProps = { contributor: FileContributor }
const Contributor = ({ contributor }: ContributorProps) => (
<ListItem className="flex items-center p-2">
<Avatar
height="40px"
width="40px"
src={contributor.avatar_url}
name={contributor.login}
me={2}
<ContributorAvatar
contributor={contributor}
label={"@" + contributor.login}
/>
<InlineLink href={"https://github.com/" + contributor.login}>
@{contributor.login}
</InlineLink>
</ListItem>
)

Expand Down Expand Up @@ -84,13 +92,7 @@ const FileContributors = ({

<Flex className="flex-col p-0 md:flex-row md:p-2" {...props}>
<Flex className="invisible me-4 flex-1 items-center md:visible md:flex">
<Avatar
height="40px"
width="40px"
src={lastContributor.avatar_url}
name={lastContributor.login}
me={2}
/>
<ContributorAvatar contributor={lastContributor} />

<p className="m-0 text-body-medium">
<Translation id="last-edit" />:{" "}
Expand Down
6 changes: 3 additions & 3 deletions src/components/IssuesList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Emoji from "react-emoji-render"
import {
Avatar,
Flex,
HStack,
SimpleGrid,
Expand All @@ -13,6 +12,7 @@ import type { GHIssue } from "@/lib/types"

import InlineLink from "../Link"
import Tag from "../Tag"
import { Avatar } from "../ui/avatar"

type IssuesListProps = SimpleGridProps & {
issues: GHIssue[]
Expand All @@ -35,8 +35,8 @@ const IssuesList = ({ issues, ...props }: IssuesListProps) => {
<Avatar
name={issue.user.login}
src={issue.user.avatar_url}
w="32px"
h="32px"
size="sm"
href={`https://github.com/${issue.user.login}`}
/>
<Text size="sm">by {issue.user.login}</Text>
</HStack>
Expand Down
11 changes: 6 additions & 5 deletions src/components/Leaderboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useTranslation } from "next-i18next"
import {
Avatar,
Box,
Flex,
LinkBox,
Expand All @@ -16,6 +15,8 @@ import { BaseLink } from "@/components/Link"

import { GITHUB_URL } from "@/lib/constants"

import { Avatar } from "./ui/avatar"

import { useRtlFlip } from "@/hooks/useRtlFlip"

type Person = {
Expand Down Expand Up @@ -95,10 +96,10 @@ const Leaderboard = ({ content, limit = 100 }: LeaderboardProps) => {
<Avatar
src={avatarImg}
name={avatarAlt}
me={4}
h={10}
w={10}
display={{ base: "none", xs: "block" }}
// This meets the Design System requirement, despite the leaderboard item itself being a link
href={hasGitHub ? `${GITHUB_URL}${username}` : "#"}
// `size-10` is not part of a "size" variant
className="me-4 size-10"
/>
<Flex flex="1 1 75%" direction="column" me={8}>
<LinkOverlay
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { LinkBox, LinkOverlay } from "./link-box"
const avatarStyles = tv({
slots: {
container:
"relative shrink-0 flex overflow-hidden rounded-full focus:outline-4 focus:-outline-offset-1 focus:rounded-full active:shadow-none [&_img]:hover:opacity-70 border border-transparent active:border-primary-hover justify-center items-center",
fallback: "bg-body text-body-inverse",
"relative shrink-0 overflow-hidden rounded-full focus:outline-4 focus:-outline-offset-1 focus:rounded-full active:shadow-none [&_img]:hover:opacity-70 border border-transparent active:border-primary-hover ",
fallback: "bg-body text-body-inverse flex justify-center items-center",
},
variants: {
size: {
Expand Down Expand Up @@ -126,7 +126,7 @@ const Avatar = React.forwardRef<
href,
src,
name,
size,
size = "md",
label,
className,
direction = "row",
Expand Down