-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #987 from mapswipe/feature/manager-dashboard/street
Create Street project drafts with the Manager Dashboard
- Loading branch information
Showing
13 changed files
with
1,334 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
manager-dashboard/app/components/Calendar/CalendarDate/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { _cs } from '@togglecorp/fujs'; | ||
|
||
import RawButton, { Props as RawButtonProps } from '../../RawButton'; | ||
import { ymdToDateString, typedMemo } from '../../../utils/common.tsx'; | ||
|
||
import styles from './styles.css'; | ||
|
||
export interface Props { | ||
className?: string; | ||
year: number; | ||
month: number; | ||
date: number; | ||
currentYear: number; | ||
currentMonth: number; | ||
activeDate?: string; | ||
currentDate: number; | ||
onClick?: (year: number, month: number, date: number) => void; | ||
elementRef?: RawButtonProps<undefined>['elementRef']; | ||
ghost?: boolean; | ||
} | ||
|
||
function CalendarDate(props: Props) { | ||
const { | ||
className, | ||
year, | ||
month, | ||
date, | ||
currentYear, | ||
currentMonth, | ||
currentDate, | ||
onClick, | ||
elementRef, | ||
activeDate, | ||
ghost, | ||
} = props; | ||
|
||
const handleClick = React.useCallback(() => { | ||
if (onClick) { | ||
onClick(year, month, date); | ||
} | ||
}, [year, month, date, onClick]); | ||
|
||
const dateString = ymdToDateString(year, month, date); | ||
|
||
return ( | ||
<RawButton | ||
elementRef={elementRef} | ||
name={date} | ||
className={_cs( | ||
styles.date, | ||
year === currentYear | ||
&& month === currentMonth | ||
&& currentDate === date | ||
&& styles.today, | ||
dateString === activeDate && styles.active, | ||
ghost && styles.ghost, | ||
className, | ||
)} | ||
onClick={handleClick} | ||
> | ||
{date} | ||
</RawButton> | ||
|
||
); | ||
} | ||
|
||
export default typedMemo(CalendarDate); |
25 changes: 25 additions & 0 deletions
25
manager-dashboard/app/components/Calendar/CalendarDate/styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.date { | ||
border-radius: 50%; | ||
width: var(--width-calendar-date); | ||
height: var(--width-calendar-date); | ||
|
||
&.today { | ||
color: var(--color-accent); | ||
font-weight: var(--font-weight-bold); | ||
} | ||
|
||
&:hover { | ||
background-color: var(--color-background-hover-light); | ||
} | ||
|
||
&.active { | ||
background-color: var(--color-accent); | ||
color: var(--color-text-on-dark); | ||
pointer-events: none; | ||
} | ||
|
||
&.ghost { | ||
opacity: 0.5; | ||
} | ||
} | ||
|
Oops, something went wrong.