diff --git a/TODO.md b/TODO.md index 5abde19..af46b38 100644 --- a/TODO.md +++ b/TODO.md @@ -82,6 +82,9 @@ - [x] Update current projects - [x] More text - [x] Update images +- [ ] update transitions to use global custom props +- [ ] include reduced motion and transparency everywhere +- [ ] update theme colors with better naming for 4 different states - [ ] Upload some photos (best off's) - [ ] Setup SimpleAnalytics or something similar - [ ] show GitHub OSS with GitHub API on a separate page diff --git a/package.json b/package.json index 5ec1cf2..ca45261 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "marvin-digital", - "version": "3.15.1", + "version": "3.15.2", "private": true, "description": "Portfolio of and by Marvin Heilemann (@muuvmuuv)", "repository": "git@github.com:muuvmuuv/portfolio.git", diff --git a/src/components/Head.jsx b/src/components/Head.jsx index 0c51b01..09d0836 100644 --- a/src/components/Head.jsx +++ b/src/components/Head.jsx @@ -3,6 +3,7 @@ import { StaticQuery, graphql } from 'gatsby' import PropTypes from 'prop-types' import { Helmet } from 'react-helmet' import { Location } from '@reach/router' +import { stringSlugify } from '../utils/helper' const Head = ({ siteTitle, @@ -40,7 +41,7 @@ const Head = ({ lang: language, }} bodyAttributes={{ - page: pageName.toLowerCase(), + page: stringSlugify(pageName), class: bodyClasses, }} title={pageTitle} diff --git a/src/components/Portfolio.jsx b/src/components/Portfolio.jsx index 7e613c8..61ade2b 100644 --- a/src/components/Portfolio.jsx +++ b/src/components/Portfolio.jsx @@ -1,5 +1,4 @@ import React from 'react' -import { graphql } from 'gatsby' import Img from 'gatsby-image' import Link from './Link' diff --git a/src/styles/pages/_about.scss b/src/styles/pages/_about.scss new file mode 100644 index 0000000..e9d2919 --- /dev/null +++ b/src/styles/pages/_about.scss @@ -0,0 +1,30 @@ +[page='about-me'] { + #article { + position: relative; + } + + .bd-img { + position: absolute; + z-index: -1; + } + + .me-gif { + top: -40px; + right: -20px; + width: 270px; + opacity: 0.2; + + @include breakpoint-down(sm) { + display: none; + } + + @include breakpoint-up(lg) { + top: 40px; + right: -120px; + } + + @include reducedMotion() { + display: none; + } + } +} diff --git a/src/templates/PageSingle.jsx b/src/templates/PageSingle.jsx index 240cb8b..66472c0 100644 --- a/src/templates/PageSingle.jsx +++ b/src/templates/PageSingle.jsx @@ -13,9 +13,11 @@ class Page extends React.Component { componentDidMount() { const { breadcrumb } = this.props.pageContext + this.setState({ pageName: this.props.pageContext.frontmatter.title }) + this.props.history.update({ location: breadcrumb.location, - crumbLabel: this.props.pageContext.frontmatter.title, + crumbLabel: this.state.pageName, crumbs: breadcrumb.crumbs, }) } diff --git a/src/utils/helper.js b/src/utils/helper.js index b27811e..882cb1d 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -119,3 +119,31 @@ export function getElapsedTime(start, end = new Date()) { return out } + +/** + * Slugify a string. + * + * @param {string} text to slugify + * @param {string} separator a separator if needed + * + * @returns {string} + */ +export function stringSlugify(text, separator) { + text = text + .toString() + .toLowerCase() + .trim() + .replace(/[ยท/_,:;']/g, '-') // Replace unwanted characters with - + .replace(/\s+/g, '-') // Replace spaces with - + .replace(/&/g, '-and-') // Replace & with 'and' + .replace(/[^\w-]+/g, '') // Remove all non-word chars + .replace(/-+/g, '-') // Replace multiple - with single - + .replace(/^-+/, '') // Trim - from start of text + .replace(/-+$/, '') // Trim - from end of text + + if (separator && separator !== '-') { + text = text.replace(/-/g, separator) + } + + return text +}