Skip to content

Commit

Permalink
[CCUBE-1626][RL] Refactor to used shared text style in HeaderCell
Browse files Browse the repository at this point in the history
  • Loading branch information
Quek Ruo Ling committed Dec 11, 2024
1 parent 4b7eccc commit 6715511
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import dayjs, { Dayjs } from "dayjs";
import { useMemo, useState } from "react";
import { Typography } from "../../../typography";
import { CalendarHelper } from "../../../util/calendar-helper";
import { HeaderCell, RowDayCell, Wrapper } from "../standard";
import { CommonCalendarProps } from "../types";
Expand Down Expand Up @@ -64,9 +63,7 @@ export const FixedRangeCalendarDayView = ({
const renderHeader = () => {
return weeksOfTheMonth[0].map((day, index) => (
<HeaderCell key={`week-day-${index}`}>
<Typography.BodySM weight="semibold">
{dayjs(day).format("ddd")}
</Typography.BodySM>
{dayjs(day).format("ddd")}
</HeaderCell>
));
};
Expand Down
1 change: 0 additions & 1 deletion src/shared/internal-calendar/single/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from "./single-calendar-day-view";
export * from "./single-calendar-day-view.style";

This file was deleted.

11 changes: 2 additions & 9 deletions src/shared/internal-calendar/single/single-calendar-day-view.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import dayjs, { Dayjs } from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
import { useMemo, useState } from "react";
import { Typography } from "../../../typography";
import { CalendarHelper } from "../../../util/calendar-helper";
import { HeaderCell, RowDayCell, Wrapper } from "../standard";
import { CommonCalendarProps } from "../types";
import {
HeaderCell,
RowDayCell,
Wrapper,
} from "./single-calendar-day-view.style";
import { SingleCell } from "./single-cell";

dayjs.extend(isBetween);
Expand Down Expand Up @@ -70,9 +65,7 @@ export const SingleCalendarDayView = ({
const renderHeader = () => {
return weeksOfTheMonth[0].map((day, index) => (
<HeaderCell key={`week-day-${index}`}>
<Typography.BodySM weight="semibold">
{dayjs(day).format("ddd")}
</Typography.BodySM>
{dayjs(day).format("ddd")}
</HeaderCell>
));
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from "styled-components";
import { Colour, Font } from "../../../theme";

export const Wrapper = styled.div`
width: 100%;
Expand All @@ -14,6 +15,9 @@ export const HeaderCell = styled.div`
height: 2.5rem;
pointer-events: none;
user-select: none;
${Font["body-sm-semibold"]};
color: ${Colour["text"]};
`;

export const RowDayCell = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dayjs, { Dayjs } from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
import { useMemo, useState } from "react";
import { Typography } from "../../../typography";
import { CalendarHelper } from "../../../util/calendar-helper";
import { CommonCalendarProps, FocusType } from "../types";
import {
Expand Down Expand Up @@ -76,9 +75,7 @@ export const StandardCalendarDayView = ({
const renderHeader = () => {
return weeksOfTheMonth[0].map((day, index) => (
<HeaderCell key={`week-day-${index}`}>
<Typography.BodySM weight="semibold">
{dayjs(day).format("ddd")}
</Typography.BodySM>
{dayjs(day).format("ddd")}
</HeaderCell>
));
};
Expand Down
5 changes: 1 addition & 4 deletions src/shared/internal-calendar/week/week-calendar-day-view.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import dayjs, { Dayjs } from "dayjs";
import { useMemo, useState } from "react";
import { V2_Text } from "../../../v2_text/text";
import { CalendarHelper } from "../../../util/calendar-helper";
import { HeaderCell, RowDayCell, Wrapper } from "../standard";
import { CommonCalendarProps } from "../types";
Expand Down Expand Up @@ -64,9 +63,7 @@ export const WeekCalendarDayView = ({
const renderHeader = () => {
return weeksOfTheMonth[0].map((day, index) => (
<HeaderCell key={`week-day-${index}`}>
<V2_Text.H6 weight="semibold">
{dayjs(day).format("ddd")}
</V2_Text.H6>
{dayjs(day).format("ddd")}
</HeaderCell>
));
};
Expand Down

0 comments on commit 6715511

Please sign in to comment.