Skip to content

Commit de60671

Browse files
committed
profile responsive layout
1 parent c8231b7 commit de60671

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

app/profile/[login]/components/profile-card.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ type ProfileCardProps = {
99

1010
export const ProfileCard: FC<ProfileCardProps> = ({ title, children }) => {
1111
return (
12-
<Card className="border-border p-4 min-w-xs flex-grow basis-0">
13-
<CardContent className="p-0 flex flex-col gap-4">
12+
<Card className="border-0 md:border-2 border-border p-0 md:p-4 min-w-xs flex-grow basis-0">
13+
<CardContent className="p-0 flex flex-col gap-1.5 md:gap-4">
1414
<h4 className="text-lg font-semibold">{title}</h4>
15-
<div className="flex flex-col gap-2">{children}</div>
15+
<div className="flex flex-col gap-1.5">{children}</div>
1616
</CardContent>
1717
</Card>
1818
);

app/profile/[login]/page.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,27 @@ export default async function Profile({ params }: { params: Promise<{ login: str
5454
const showContact = !!user?.email || !!user?.websiteUrl || !!user?.socialAccounts?.nodes?.length;
5555

5656
return (
57-
<Page className="gap-6 flex-row">
58-
<div className="w-3xs xl:w-2xs flex flex-col gap-4">
59-
<div className="flex flex-col gap-4">
60-
<AspectRatio ratio={1}>
61-
<Avatar className="w-full h-full rounded-full" asChild>
62-
<AvatarImage src={user.avatarUrl!} />
63-
</Avatar>
64-
</AspectRatio>
57+
<Page className="gap-6 flex-col md:flex-row">
58+
<div className="w-full md:w-3xs xl:w-2xs flex flex-col shrink-0 gap-4">
59+
<div className="flex flex-row md:flex-col items-center md:items-start gap-4">
60+
<div className="w-[64] sm:w-[128] md:w-full">
61+
<AspectRatio ratio={1}>
62+
<Avatar className="w-full h-full rounded-full" asChild>
63+
<AvatarImage src={user.avatarUrl!} />
64+
</Avatar>
65+
</AspectRatio>
66+
</div>
6567
<div>
6668
<h1 className="font-semibold text-2xl">{user.name}</h1>
6769
<h2 className="text-muted-foreground">@{user.login}</h2>
6870
</div>
6971
</div>
70-
<div className="flex flex-col gap-4">
71-
<Button className="w-full">
72+
<div className="flex flex-row md:flex-col gap-4">
73+
<Button size="sm" className="flex-grow">
7274
Refresh
7375
<RefreshCw className="size-4" />
7476
</Button>
75-
<Button variant="secondary" className="w-full" asChild>
77+
<Button size="sm" variant="secondary" className="flex-grow" asChild>
7678
<Link href={`https://github.com/${user.login}`} target="_blank" rel="noopener noreferrer">
7779
Open GitHub
7880
<ExternalLink className="size-4" />
@@ -138,7 +140,7 @@ export default async function Profile({ params }: { params: Promise<{ login: str
138140
</div>
139141
</div>
140142
<div className="flex-grow flex flex-col gap-6">
141-
<div className="flex flex-wrap gap-6">
143+
<div className="flex flex-col md:flex-row flex-wrap gap-6">
142144
<RanksOverview ranksData={user.rank} />
143145
<RepositoriesOverview
144146
repositories={user.repositories}

0 commit comments

Comments
 (0)