Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaBanaszkiewicz committed Nov 28, 2024
1 parent 80d2bdb commit e817c63
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ const code = `
import { DatePicker } from '@mantine/dates';
function Demo() {
return <DatePicker showWeekNumbers />;
return <DatePicker withWeekNumbers />;
}
`;

function Demo() {
return <DatePicker showWeekNumbers />;
return <DatePicker withWeekNumbers />;
}

export const showWeekNumbers: MantineDemo = {
export const withWeekNumbers: MantineDemo = {
type: 'code',
centered: true,
component: Demo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const Demo_excludeDate = {
render: renderDemo(demos.excludeDate),
};

export const Demo_showWeekNumbers = {
name: '⭐ Demo: showWeekNumbers',
render: renderDemo(demos.showWeekNumbers),
export const Demo_withWeekNumbers = {
name: '⭐ Demo: withWeekNumbers',
render: renderDemo(demos.withWeekNumbers),
};
2 changes: 1 addition & 1 deletion packages/@docs/demos/src/demos/dates/DatePicker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export { renderDay } from './DatePicker.demo.renderDay';
export { hideWeekdays } from './DatePicker.demo.hideWeekdays';
export { hideOutsideDates } from './DatePicker.demo.hideOutsideDates';
export { excludeDate } from './DatePicker.demo.excludeDate';
export { showWeekNumbers } from './DatePicker.demo.showWeekNumbers';
export { withWeekNumbers } from './DatePicker.demo.withWeekNumbers';
4 changes: 2 additions & 2 deletions packages/@mantine/dates/src/components/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const Calendar = factory<CalendarFactory>((_props, ref) => {
__onDayMouseEnter,
withCellSpacing,
highlightToday,
showWeekNumbers,
withWeekNumbers,

// YearLevelGroup props
monthsListFormat,
Expand Down Expand Up @@ -350,7 +350,7 @@ export const Calendar = factory<CalendarFactory>((_props, ref) => {
static={isStatic}
withCellSpacing={withCellSpacing}
highlightToday={highlightToday}
showWeekNumbers={showWeekNumbers}
withWeekNumbers={withWeekNumbers}
{...stylesApiProps}
/>
)}
Expand Down
4 changes: 4 additions & 0 deletions packages/@mantine/dates/src/components/Month/Month.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
}

.weekNumber {
--wn-size-xs: 30px;
--wn-size-sm: 36px;
--wn-size-md: 42px;
--wn-size-lg: 48px;
--wn-size-xl: 54px;
color: var(--mantine-color-dimmed);
font-weight: normal;
font-size: var(--wn-fz, var(--mantine-font-size-sm));
Expand Down
4 changes: 2 additions & 2 deletions packages/@mantine/dates/src/components/Month/Month.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ export function Sizes() {
return sizes;
}

export function showWeekNumbers() {
return <Wrapper showWeekNumbers />;
export function withWeekNumbers() {
return <Wrapper withWeekNumbers />;
}
8 changes: 4 additions & 4 deletions packages/@mantine/dates/src/components/Month/Month.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export interface MonthSettings {
highlightToday?: boolean;

/** Determines whether week numbers should be displayed */
showWeekNumbers?: boolean;
withWeekNumbers?: boolean;
}

export interface MonthProps
Expand Down Expand Up @@ -173,7 +173,7 @@ export const Month = factory<MonthFactory>((_props, ref) => {
withCellSpacing,
size,
highlightToday,
showWeekNumbers,
withWeekNumbers,
...others
} = props;

Expand Down Expand Up @@ -278,7 +278,7 @@ export const Month = factory<MonthFactory>((_props, ref) => {

return (
<tr key={rowIndex} {...getStyles('monthRow')}>
{showWeekNumbers && <td {...getStyles('weekNumber')}>{getWeekNumber(row)}</td>}
{withWeekNumbers && <td {...getStyles('weekNumber')}>{getWeekNumber(row)}</td>}
{cells}
</tr>
);
Expand All @@ -297,7 +297,7 @@ export const Month = factory<MonthFactory>((_props, ref) => {
classNames={resolvedClassNames}
styles={resolvedStyles}
unstyled={unstyled}
showWeekNumbers={showWeekNumbers}
withWeekNumbers={withWeekNumbers}
/>
</thead>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const MonthLevel = factory<MonthLevelFactory>((_props, ref) => {
__onDayMouseEnter,
withCellSpacing,
highlightToday,
showWeekNumbers,
withWeekNumbers,

// CalendarHeader settings
__preventFocus,
Expand Down Expand Up @@ -182,7 +182,7 @@ export const MonthLevel = factory<MonthLevelFactory>((_props, ref) => {
static={isStatic}
withCellSpacing={withCellSpacing}
highlightToday={highlightToday}
showWeekNumbers={showWeekNumbers}
withWeekNumbers={withWeekNumbers}
{...stylesApiProps}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const MonthLevelGroup = factory<MonthLevelGroupFactory>((_props, ref) =>
__onDayMouseEnter,
withCellSpacing,
highlightToday,
showWeekNumbers,
withWeekNumbers,

// CalendarHeader settings
__preventFocus,
Expand Down Expand Up @@ -163,7 +163,7 @@ export const MonthLevelGroup = factory<MonthLevelGroupFactory>((_props, ref) =>
static={isStatic}
withCellSpacing={withCellSpacing}
highlightToday={highlightToday}
showWeekNumbers={showWeekNumbers}
withWeekNumbers={withWeekNumbers}
/>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface WeekdaysRowProps
cellComponent?: 'td' | 'th';

/** Determines whether week numbers should be displayed */
showWeekNumbers?: boolean;
withWeekNumbers?: boolean;
}

export type WeekdaysRowFactory = Factory<{
Expand Down Expand Up @@ -77,7 +77,7 @@ export const WeekdaysRow = factory<WeekdaysRowFactory>((_props, ref) => {
weekdayFormat,
cellComponent: CellComponent = 'th',
__staticSelector,
showWeekNumbers,
withWeekNumbers,
...others
} = props;

Expand Down Expand Up @@ -109,7 +109,7 @@ export const WeekdaysRow = factory<WeekdaysRowFactory>((_props, ref) => {

return (
<Box component="tr" ref={ref} {...getStyles('weekdaysRow')} {...others}>
{showWeekNumbers && <CellComponent {...getStyles('weekday')}>#</CellComponent>}
{withWeekNumbers && <CellComponent {...getStyles('weekday')}>#</CellComponent>}
{weekdays}
</Box>
);
Expand Down

0 comments on commit e817c63

Please sign in to comment.