-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add introduction information to the website (#376)
- Loading branch information
1 parent
80218c0
commit c2afc73
Showing
4 changed files
with
78 additions
and
0 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 |
---|---|---|
|
@@ -70,3 +70,6 @@ pnpm-lock.yaml | |
.yarn-integrity | ||
# semantic dist | ||
src/semantic/dist | ||
|
||
# IDEA | ||
.idea/ |
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,65 @@ | ||
import React from 'react'; | ||
import { Button, Card } from 'semantic-ui-react'; | ||
import { graphql, StaticQuery } from 'gatsby'; | ||
import { getLanguage, getTranslation, metadata } from '../data/i18n'; | ||
|
||
class IntroInformation extends React.Component { | ||
render() { | ||
const language = | ||
typeof window !== 'undefined' | ||
? getLanguage(window) | ||
: metadata.defaultLocale; | ||
let intro_information = this.props.data.allContentfulIntroInformation.nodes.filter( | ||
d => d.node_locale === language | ||
)[0]; //get only the first element | ||
|
||
let color = this.props.data.contentfulBoard.color; | ||
console.log(color); | ||
|
||
return ( | ||
<> | ||
<div> | ||
<h2>{intro_information.title}</h2> | ||
<Card fluid> | ||
<div>{intro_information.description.description}</div> | ||
<Button | ||
href={intro_information.introWebsiteUrl} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="button" | ||
style={{ backgroundColor: color, color: 'white' }} | ||
> | ||
{intro_information.linkToWebsiteButtonText} | ||
</Button> | ||
</Card> | ||
</div> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
const introInformationQuery = graphql` | ||
query introInformationQuery { | ||
allContentfulIntroInformation { | ||
nodes { | ||
node_locale | ||
title | ||
linkToWebsiteButtonText | ||
description { | ||
description | ||
} | ||
introWebsiteUrl | ||
} | ||
} | ||
contentfulBoard(current: { eq: true }) { | ||
color | ||
} | ||
} | ||
`; | ||
|
||
export default props => ( | ||
<StaticQuery | ||
query={introInformationQuery} | ||
render={data => <IntroInformation data={data} {...props} />} | ||
/> | ||
); |
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