-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance: add animation as switching containers (#150)
- Loading branch information
Showing
9 changed files
with
179 additions
and
94 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
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
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
66 changes: 66 additions & 0 deletions
66
packages/ui-app/app/_features/Project/VisionTimeline/TimelineItem.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,66 @@ | ||
import { ITimelineItem } from '@shared/ui' | ||
import { useVisionContext } from '../Vision/context' | ||
import { isSameDay } from 'date-fns' | ||
import { HiOutlineFlag } from 'react-icons/hi2' | ||
import { dateFormat } from '@shared/libs' | ||
import MemberAvatar from '@/components/MemberAvatar' | ||
import ProgressBar from '@/components/ProgressBar' | ||
|
||
export default function TimelineItem({ start, end, id, title }: ITimelineItem) { | ||
const { getVisionProgress, getVisionData } = useVisionContext() | ||
// {data => { | ||
|
||
const progress = getVisionProgress(id) | ||
const visionData = getVisionData(id) | ||
const assigneeIds = Array.from(new Set(visionData.assigneeIds)) | ||
|
||
const displayAssignees = assigneeIds.slice(0, 3) | ||
const restAssignees = assigneeIds.slice(3).length | ||
const isSame = isSameDay(start, end) | ||
const hasTask = visionData.done || visionData.total | ||
|
||
return ( | ||
<div className="flex items-center justify-between"> | ||
<div className={`w-full ${isSame ? 'pl-6' : ''}`}> | ||
<section className="flex items-center gap-4 justify-between"> | ||
<div> | ||
<span>{title}</span> | ||
<div className="flex items-center gap-1 text-[11px] text-gray-400"> | ||
<HiOutlineFlag /> | ||
<div>{dateFormat(start, 'MMM dd')}</div> | ||
<span>-</span> | ||
<div>{dateFormat(end, 'MMM dd')}</div> | ||
</div> | ||
</div> | ||
<div className="flex items-center -space-x-3"> | ||
{displayAssignees.map(assigneeId => { | ||
return ( | ||
<MemberAvatar noName={true} uid={assigneeId} key={assigneeId} /> | ||
) | ||
})} | ||
|
||
{restAssignees ? ( | ||
<div className="h-6 w-6 bg-gray-50 rounded-full text-[11px] flex items-center justify-center"> | ||
+3 | ||
</div> | ||
) : null} | ||
</div> | ||
</section> | ||
{hasTask ? ( | ||
<section className="mt-1 flex items-center gap-2 w-[250px]"> | ||
<ProgressBar | ||
color={progress === 100 ? 'green' : 'blue'} | ||
variant="square" | ||
progress={progress || 0} | ||
/> | ||
<div className="text-[11px] dark:text-gray-400 space-x-2"> | ||
<span>{visionData.total} Total</span> | ||
<span>{visionData.done} Done</span> | ||
</div> | ||
</section> | ||
) : null} | ||
</div> | ||
</div> | ||
) | ||
// }} | ||
} |
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
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 |
---|---|---|
|
@@ -9188,6 +9188,13 @@ fraction.js@^4.2.0: | |
resolved "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz" | ||
integrity sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA== | ||
|
||
framer-motion@^11.0.20: | ||
version "11.0.20" | ||
resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-11.0.20.tgz#6bb72bd0b8020fc417a40453b9247d596acbea78" | ||
integrity sha512-YSDmWznt3hpdERosbE0UAPYWoYhTnmQ0J1qWPsgpCia9NgY8Xsz5IpOiUEGGj/nzCAW29fSrWugeLRkdp5de7g== | ||
dependencies: | ||
tslib "^2.4.0" | ||
|
||
[email protected]: | ||
version "0.5.2" | ||
resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" | ||
|