Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/social card font #302

Closed
wants to merge 4 commits into from
Closed
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
34 changes: 24 additions & 10 deletions app/[username]/wrapped/sections/wrapped-social-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { WrappedWithData } from "~app/[username]/wrapped/wrapped-types";
import html2canvas from "html2canvas";
import { getUserProfilePhoto } from "~src/utils/metadata";
import { Bangers } from "next/font/google";
import { SectionWrapper } from "./section-wrapper";
import { SectionTitle } from "./section-title";
import { SectionBody } from "./section-body";
Expand All @@ -23,14 +22,10 @@ import {
PatreonBunnySvgWithoutLink,
} from "~app/patron/patreon-info";

const bangers = Bangers({
weight: "400",
subsets: ["latin"],
display: "swap",
});

interface HiddenDataSummaryProps {
gameImageUrl: string | undefined;
// eslint-disable-next-line
bangers: any;
wrapped: WrappedWithData;
cardRef: RefObject<HTMLDivElement>;
profilePhoto: string | undefined;
Expand All @@ -42,7 +37,15 @@ interface HiddenDataSummaryProps {
}[];
}
const HiddenDataSummary = memo<HiddenDataSummaryProps>(
({ gameImageUrl, wrapped, cardRef, isPatron, profilePhoto, top3Games }) => {
({
gameImageUrl,
wrapped,
cardRef,
isPatron,
profilePhoto,
top3Games,
bangers,
}) => {
return (
<div
style={{
Expand Down Expand Up @@ -189,7 +192,7 @@ const HiddenDataSummary = memo<HiddenDataSummaryProps>(
justifyContent: "center",
}}
>
<LayeredStats wrapped={wrapped} />
<LayeredStats wrapped={wrapped} bangers={bangers} />
</div>

<div
Expand Down Expand Up @@ -358,6 +361,8 @@ HiddenDataSummary.displayName = "HiddenDataSummary";

interface WrappedSocialCardProps {
wrapped: WrappedWithData;
// eslint-disable-next-line
bangers: any;
onImageGenerated?: (imageData: {
previewUrl: string;
blob: Blob | undefined;
Expand All @@ -372,6 +377,7 @@ interface WrappedSocialCardProps {

export function WrappedSocialCard({
wrapped,
bangers,
onImageGenerated,
onLoadingStateChange,
}: WrappedSocialCardProps): ReactElement {
Expand Down Expand Up @@ -627,6 +633,7 @@ export function WrappedSocialCard({
)}
<HiddenDataSummary
gameImageUrl={belovedGameImageUrl}
bangers={bangers}
wrapped={wrapped}
cardRef={cardRef}
isPatron={isPatron}
Expand All @@ -639,7 +646,14 @@ export function WrappedSocialCard({
);
}

const LayeredStats = ({ wrapped }: { wrapped: WrappedWithData }) => {
const LayeredStats = ({
wrapped,
bangers,
}: {
wrapped: WrappedWithData;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bangers: any;
}) => {
const stats = [
{ value: wrapped.totalRuns, label: "RUN", color: "#4f46e5" },
{
Expand Down
8 changes: 8 additions & 0 deletions app/[username]/wrapped/the-run-wrapped.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ import { SocialShareSpeedDial } from "./social-share-dial";
import { PatreonBunnySvg } from "~app/patron/patreon-info";
import { WrappedSocialCard } from "./sections/wrapped-social-card";
import { safeDecodeURI } from "~src/utils/uri";
import { Bangers } from "next/font/google";

const bangers = Bangers({
weight: "400",
subsets: ["latin"],
display: "swap",
});

gsap.registerPlugin(useGSAP);
gsap.registerPlugin(ScrollTrigger);
Expand Down Expand Up @@ -225,6 +232,7 @@ export const TheRunWrapped = ({ wrapped, user }: TheRunWrappedProps) => {
>
<WrappedSocialCard
wrapped={wrapped}
bangers={bangers}
onImageGenerated={handleSocialImageGenerated}
onLoadingStateChange={handleSocialImageLoadingStateChange}
/>
Expand Down
Loading