Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding clickable image #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"endOfLine": "lf",
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"bracketSpacing": true
}
1 change: 1 addition & 0 deletions front-end/content/index/hero.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: hero
alt: true
imgClickUrl: ../../gov-au_observatory-funtional-behaviour.png
imgUrl: ../../hero-jellyfish--white.png
imgAlt: A network graph of 38 nodes showing the connections of government web sites and services.
imgCaption: "The Jelly Fish: Graphic visualisation of two weeks of user traffic across 38 gov.au websites from May 2019."
Expand Down
14 changes: 9 additions & 5 deletions front-end/src/components/layouts/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import React from "react";
interface Props {
children: React.ReactElement;
alt?: Boolean;
imgClickUrl: string;
imgUrl: string;
imgAlt: string;
imgCaption: string;
}

const Hero: React.FC<Props> = ({
children,
imgClickUrl,
imgUrl,
imgAlt,
imgCaption,
Expand All @@ -25,11 +27,13 @@ const Hero: React.FC<Props> = ({

<div className="col-md-6 col-xs-12">
<figure className="hero-image">
<img
className="au-responsive-media-img"
src={imgUrl}
alt={imgAlt}
/>
<a href={imgClickUrl}>
<img
className="au-responsive-media-img"
src={imgUrl}
alt={imgAlt}
/>
</a>
<figcaption className="hero-image__caption">
{imgCaption}
</figcaption>
Expand Down
2 changes: 2 additions & 0 deletions front-end/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const IndexPage = () => {
frontmatter {
id
alt
imgClickUrl
imgUrl
imgAlt
imgCaption
Expand Down Expand Up @@ -49,6 +50,7 @@ const IndexPage = () => {
<Hero
alt={hero.frontmatter.alt}
imgAlt={hero.frontmatter.imgAlt}
imgClickUrl={hero.frontmatter.imgClickUrl}
imgUrl={hero.frontmatter.imgUrl}
imgCaption={hero.frontmatter.imgCaption}
>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.