-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
149 additions
and
37 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use client' | ||
|
||
import { useState } from 'react' | ||
import styled from 'styled-components' | ||
import ResponsiveImage, { ResponsiveImageProps } from '../ResponsiveImage' | ||
|
||
export interface DownloadGuideCardProps { | ||
imgProps: ResponsiveImageProps | ||
downloadlink: string | ||
onDownloadStart?: () => void | ||
} | ||
|
||
const StyledWrapper = styled.div` | ||
position: relative; | ||
display: flex; | ||
cursor: pointer; | ||
> .hover-background { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.2); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
color: white; | ||
font-size: 2rem; | ||
} | ||
` | ||
|
||
export default function DownloadGuideCard({ | ||
imgProps, | ||
downloadlink, | ||
onDownloadStart, | ||
}: DownloadGuideCardProps) { | ||
const [isHovered, setIsHovered] = useState(false) | ||
const handleClick = () => { | ||
if (onDownloadStart) { | ||
onDownloadStart() | ||
} | ||
window.open(downloadlink, '_blank') | ||
} | ||
|
||
console.log('isHovered', isHovered) | ||
|
||
return ( | ||
<StyledWrapper onClick={handleClick} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false) }}> | ||
{isHovered && <div className="hover-background"><span className="fr-icon-download-line" /></div>} | ||
<ResponsiveImage {...imgProps} /> | ||
</StyledWrapper> | ||
) | ||
} |
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