Skip to content

Commit

Permalink
Fix href handling @ Card
Browse files Browse the repository at this point in the history
  • Loading branch information
yentsun committed Mar 26, 2024
1 parent 1e9df39 commit d22c0a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import useFetchData from '../hooks/useFetchData';

export default function Card({ href, thumb, major, minor, content, isLoading }) {

return <div className="card" onClick={ () => window.location = href }>
const clickable = Boolean(href); // for later use in tailwind classes

return <div className="card" onClick={ clickable ? () => window.location = href : ()=>{} }>

{ isLoading &&
<h1>Loading...</h1> }
Expand Down
2 changes: 1 addition & 1 deletion src/components/Cards/GitHub.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function GitHub() {

const { yentsun, lastEvent } = useGithub();

return <Card isLoading={ ! yentsun } thumb="github.gif"
return <Card isLoading={ ! yentsun } thumb="github.gif" href="https://github.com/yentsun"
major={`repos: ${yentsun?.public_repos}` }
minor={ `followers: ${yentsun?.followers}` }
content={ lastEvent
Expand Down

0 comments on commit d22c0a0

Please sign in to comment.