site/src/pages/about.js

105 lines
3.4 KiB
JavaScript
Raw Normal View History

2020-01-15 17:45:50 +03:00
import React from "react"
2020-02-24 19:40:25 +03:00
import { FormattedMessage, FormattedHTMLMessage, useIntl, Link, injectIntl } from "gatsby-plugin-intl"
import { graphql } from "gatsby"
2020-01-15 17:45:50 +03:00
import Layout from "../components/layout"
2020-02-24 19:40:25 +03:00
import SEO from "../components/seo"
2020-01-15 17:45:50 +03:00
import "../styles/main.css"
2020-02-24 19:40:25 +03:00
const AboutPage = ({ data }) => {
const intl = useIntl()
const lang = intl.locale
var members = ""
if ( lang==="ru" ) { members = data.ru_members.edges; }
else if ( lang==="en" ) { members = data.en_members.edges; }
return(
2020-01-15 17:45:50 +03:00
<Layout>
2020-02-24 19:40:25 +03:00
<SEO lang={lang} title={intl.formatMessage({ id: "title" })} />
<h1 style = {{marginTop: `20px`}}><FormattedMessage id="about.title" /></h1>
<p style = {{marginTop: `0px`}}><FormattedMessage id="about.descr" /></p>
2020-01-15 17:45:50 +03:00
2020-02-24 19:40:25 +03:00
<h2 id="publications"><FormattedMessage id="about.pubs.title" /></h2>
<p style = {{marginTop: `0px`, marginBottom: `0px`}}><FormattedHTMLMessage id="about.pubs.available1"/><Link to="/publications"><FormattedMessage id="about.pubs.available2"/></Link></p>
2020-01-15 17:45:50 +03:00
2020-02-24 19:40:25 +03:00
<h2 id="contacts"><FormattedMessage id="about.contacts.title" /></h2>
<p style = {{marginTop: `0px`, marginBottom: `0px`}}><FormattedMessage id="about.contacts.mail" /><a href='mailto&#58;&#110;p&#109;&#64;m%&#54;&#57;%70&#116;&#46;ru'>npm&#64;mip&#116;&#46;ru</a></p>
<p style = {{marginTop: `0px`}}><FormattedMessage id="about.contacts.telegram" /><a href="https://t.me/mipt_npm">https://t.me/mipt_npm</a></p>
2020-01-15 17:45:50 +03:00
{/* ------------------------------ */}
2020-02-24 19:40:25 +03:00
{ members.map(({node}) => {
const name = node.frontmatter.title;
const photo = node.frontmatter.photo;
2020-01-15 17:45:50 +03:00
const path = "../../images/members/"
if (photo === null)
return(
<div>
<hr/>
2020-02-18 23:29:14 +03:00
<div className = "row">
<div className = "col-lg-2"></div>
<div className = "col-lg-10">
2020-01-15 17:45:50 +03:00
<h2>{name}</h2>
<p
dangerouslySetInnerHTML = {{
2020-02-24 19:40:25 +03:00
__html: node.html,
2020-01-15 17:45:50 +03:00
}}
/>
</div>
</div>
</div>
)
else
return (
<div>
<hr/>
2020-02-18 23:29:14 +03:00
<div className = "row">
<div className = "col-lg-2">
2020-01-15 17:45:50 +03:00
<img src={path+photo} alt=" "/>
</div>
2020-02-18 23:29:14 +03:00
<div className = "col-lg-10">
2020-01-15 17:45:50 +03:00
<h2>{name}</h2>
<p
dangerouslySetInnerHTML = {{
2020-02-24 19:40:25 +03:00
__html: node.html,
2020-01-15 17:45:50 +03:00
}}
/>
</div>
</div>
</div>
)
})}
</Layout>
2020-02-24 19:40:25 +03:00
)
}
2020-01-15 17:45:50 +03:00
2020-02-24 19:40:25 +03:00
export default injectIntl(AboutPage)
2020-01-15 17:45:50 +03:00
export const query = graphql`
query {
2020-02-24 19:40:25 +03:00
ru_members: allMarkdownRemark(filter: {frontmatter: {content_type: {eq: "member"}, published: {eq: true}, language: {eq: "ru"}}},
2020-01-15 17:45:50 +03:00
sort: {fields: frontmatter___order, order: ASC}) {
2020-02-24 19:40:25 +03:00
edges{
node {
2020-01-15 17:45:50 +03:00
html
frontmatter {
title
photo
2020-02-24 19:40:25 +03:00
language
2020-01-15 17:45:50 +03:00
}
}
2020-02-24 19:40:25 +03:00
}
}
en_members: allMarkdownRemark(filter: {frontmatter: {content_type: {eq: "member"}, published: {eq: true}, language: {eq: "en"}}},
sort: {fields: frontmatter___order, order: ASC}) {
edges{
node {
html
frontmatter {
title
photo
language
}
}
}
2020-01-15 17:45:50 +03:00
}
}`