Skip to content

Commit

Permalink
Improved cellphone support for calendars.
Browse files Browse the repository at this point in the history
  • Loading branch information
originalnicodr committed Dec 31, 2023
1 parent 6a29833 commit 9320c8d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
9 changes: 6 additions & 3 deletions components/charts/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ export const Calendar = (props: Omit<CalendarSvgProps, "height" | "width">) => {
dayBorderWidth={2}
legends={[
{
anchor: "top",
direction: "row",
anchor: typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? 'left' : 'top',
translateX: typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? 0 : -50,
direction: typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? 'column' : 'row',
itemCount: 8,
itemWidth: 42,
itemHeight: 0,
itemHeight: 30,
itemsSpacing: 14,
itemDirection: "right-to-left",
itemTextColor: "#DBDFD8", //framed-white
},
]}
theme={{ textColor: "#DBDFD8" }} //framed-white
direction={typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? 'vertical' : 'horizontal'}
align={typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? 'right' : 'center'}
{...props}
/>
);
Expand Down
22 changes: 17 additions & 5 deletions pages/_year-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -708,12 +708,18 @@ export default function WrapYear(year: number, flavourText: { intro: any; top10s
</div>
</div>
</div>
<div className="calendar h-screen grid grid-rows-2 gap-x-8 md:overflow-hidden">
<div className="calendar h-auto grid grid-rows-2 gap-x-8 md:overflow-hidden" >
<div
className="flex flex-col items-center w-h-screen md:w-full"
className="flex flex-col items-center"
style={{
height: typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? window.innerHeight * 1.5 : window.innerHeight * 0.5,
width: typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? window.innerWidth * 0.7 : window.innerWidth * 0.8,
flex: 1,
margin: "auto",
}}
ref={segments["Daily Share Your Shot"]}
>
<h3 className="font-semibold text-3xl pl-20">
<h3 className="font-semibold text-3xl">
Share Your Shot Calendar in {year}
</h3>
<Calendar
Expand All @@ -728,10 +734,16 @@ export default function WrapYear(year: number, flavourText: { intro: any; top10s
/>
</div>
<div
className="flex flex-col items-center w-h-screen md:w-full"
className="flex flex-col items-center"
style={{
height: typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? window.innerHeight * 1.5 : window.innerHeight * 0.5,
width: typeof window !== "undefined" && window.innerWidth / window.innerHeight < 1 ? window.innerWidth * 0.7 : window.innerWidth * 0.8,
flex: 1,
margin: "auto",
}}
ref={segments["Daily Hall of Framed"]}
>
<h3 className="font-semibold text-3xl pl-20">
<h3 className="font-semibold text-3xl">
Hall of Framed Calendar in {year}
</h3>
<Calendar
Expand Down

0 comments on commit 9320c8d

Please sign in to comment.