-
Notifications
You must be signed in to change notification settings - Fork 253
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 #7 from Ray-D-Song/dev
feat: skeleton and mobile layout
- Loading branch information
Showing
9 changed files
with
113 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useState, useEffect } from 'react' | ||
|
||
interface SkeletonWrapperProps { | ||
loadingDeps: boolean | ||
skeleton: React.ReactNode | ||
children: React.ReactNode | ||
minDisplayTime?: number | ||
} | ||
|
||
function SkeletonWrapper({ | ||
loadingDeps, | ||
skeleton, | ||
children, | ||
minDisplayTime = 500 | ||
}: SkeletonWrapperProps) { | ||
const [showSkeleton, setShowSkeleton] = useState(false) | ||
|
||
useEffect(() => { | ||
let timer: NodeJS.Timeout | ||
if (loadingDeps) { | ||
setShowSkeleton(true) | ||
timer = setTimeout(() => { | ||
if (!loadingDeps) { | ||
setShowSkeleton(false) | ||
} | ||
}, minDisplayTime) | ||
} else { | ||
timer = setTimeout(() => { | ||
setShowSkeleton(false) | ||
}, minDisplayTime) | ||
} | ||
return () => clearTimeout(timer) | ||
}, [loadingDeps, minDisplayTime]) | ||
|
||
return showSkeleton ? skeleton : children | ||
} | ||
|
||
export default SkeletonWrapper |
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,16 @@ | ||
import { SquareMenu } from 'lucide-react' | ||
|
||
interface HamburgerProps { | ||
className?: string | ||
onClick?: () => void | ||
} | ||
|
||
function Hamburger({ className, onClick }: HamburgerProps) { | ||
return ( | ||
<div className={`text-white bg-blue-600 py-2 pr-3 pl-1 rounded-r-[50%] ${className}`} onClick={onClick}> | ||
<SquareMenu className="h-5 w-5" /> | ||
</div> | ||
) | ||
} | ||
|
||
export default Hamburger |
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
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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
- [ ] Showcase feature (Show some of your collected web pages) | ||
- [ ] Tag feature (Tag your web pages, and use tag as a filter condition) | ||
- [x] Showcase feature (Show some of your collected web pages) | ||
- [ ] Tag feature (Tag your web pages, and use tag as a filter condition) | ||
- [x] Skeleton screen | ||
- [ ] Update page meta information | ||
- [x] Mobile support | ||
- [ ] PWA support |