Skip to content

Commit

Permalink
Remove repo link on small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
AljoschaMeyer committed Aug 8, 2023
1 parent 6a5f1ae commit ef8e313
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
5 changes: 0 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,6 @@
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div class="github-link">
<a href="https://github.com/sgwilym/seasonal-hours-clock">
source code
</a>
</div>
<div id="root"></div>
</body>
</html>
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { hourTable } from "./seasonal-hours";
import Resizer from "./resizer";
import NowUpdater from "./now-updater";
import { Clock } from "./clock";
import RepoLink from "./repo-link";

let url = new URL(window.location.href);

Expand Down Expand Up @@ -134,6 +135,7 @@ export default function App() {
hourTable={hourTable}
/>
</NowUpdater>
<RepoLink />
</Resizer>
</div>
);
Expand Down
17 changes: 17 additions & 0 deletions src/repo-link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useContext } from "react";

import { ViewportSizeContext } from "./viewport-size-context";

export default function RepoLink() {
const { height, width } = useContext(ViewportSizeContext);

let show_about = Math.abs(height - width) >= 150 || width >= 300;

return (
show_about && (
<div className="github-link">
<a href="https://github.com/sgwilym/seasonal-hours-clock">about</a>
</div>
)
);
}

0 comments on commit ef8e313

Please sign in to comment.