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
const css2obj = css => { | |
const regex = /(?<=^|;)\s*([^:]+)\s*:\s*([^;]+)\s*/g | |
const styles = {}; | |
css.replace(regex, (_,p,value) => { | |
const property = p.replace(/-(.)/g, (_,p) => p.toUpperCase()) | |
styles[property] = value | |
}); | |
return styles; |
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
import * as Stitches from '@stitches/react'; | |
import { theme } from '@config/stitches.config'; | |
const COLOR_PATTERN = '$––color––'; | |
const REGEX = /\"([^\"]*?\$––color––[^\"]*?)\"/; | |
export const generateColorPaletteVariants = (css: Stitches.CSS) => { | |
const cssString = JSON.stringify(css); |
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
<div style={{ position: 'relative', overflow: 'hidden', height: '600px' }}> | |
<Image | |
src={image.srcUrl} | |
alt="Image" | |
fill={true} | |
style={{ objectFit: 'cover' }} | |
/> | |
</div> |
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
<Image | |
src={image.srcUrl} | |
alt="Image" | |
width={600} // If you import the image locally, you can omit this | |
height={600} // If you import the image locally, you can omit this | |
/> |
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
... | |
const Hero = ({ content }) => { | |
const { frontmatter, rawMarkdownBody } = content | |
return ( | |
<StyledSection id="hero"> | |
<h1 className="title"> | |
{frontmatter.greetings}{" "} | |
<span role="img" aria-label="emoji"> | |
{frontmatter.emoji} | |
</span> |
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
import React from "react" | |
import { graphql } from "gatsby" | |
import Layout from "../components/layout" | |
import Hero from "../components/hero" | |
const IndexPage = ({ data }) => { | |
return ( | |
<Layout> | |
<Hero content={data.hero.edges[0].node} /> |
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
export const pageQuery = graphql` | |
{ | |
hero: allMarkdownRemark { | |
edges { | |
node { | |
frontmatter { | |
title | |
greetings | |
emoji | |
subtitlePrefix |
NewerOlder