Skip to content

Commit

Permalink
feat: Storybook publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwilson committed Jun 9, 2024
1 parent c83fa0f commit 7066a85
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 45,273 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
- name: Install Dependencies
run: |
npm config set legacy-peer-deps true
npm ci --ignore-scripts --workspace @alexwilson/personal-website
npm install --workspace @alexwilson/personal-website
npm rebuild
- name: Build
run: npx lerna run --scope @alexwilson/personal-website build
env:
Expand Down Expand Up @@ -80,7 +81,8 @@ jobs:
- name: Install Dependencies
run: |
npm config set legacy-peer-deps true
npm ci --ignore-scripts --workspace @alexwilson/personal-website
npm install --workspace @alexwilson/personal-website
ls -la node_modules/@parcel/watcher
- name: Run Tests
run: npx lerna run --scope @alexwilson/personal-website test

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/monorepo-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ jobs:
cache: "npm"
- name: Install Dependencies
run: |
rm services/personal-website/package.json
rm services/personal-website/package.json
npm config set legacy-peer-deps true
npm ci --ignore-scripts --production=false
npm install --include=dev
npm install lerna
- id: find-projects
name: Find affected projects
run: |
Expand Down Expand Up @@ -70,6 +71,7 @@ jobs:
runs-on: ubuntu-latest
env:
NODE_ENV: ${{ secrets.NODE_ENV }}
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
strategy:
matrix: ${{ fromJson(needs.prepare.outputs.projects) }}
steps:
Expand All @@ -85,7 +87,7 @@ jobs:
run: |
rm services/personal-website/package.json
npm config set legacy-peer-deps true
npm ci --ignore-scripts --production=false
npm install --include=dev
- name: Test
run: npx lerna run test --scope ${{ matrix.name }}

Expand Down Expand Up @@ -118,11 +120,12 @@ jobs:
run: |
rm services/personal-website/package.json
npm config set legacy-peer-deps true
npm ci --ignore-scripts --production=false
npm install --include=dev
- name: Deploy
run: npx lerna run deploy --scope ${{ matrix.name }}
env:
CI: true
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
58 changes: 32 additions & 26 deletions components/legacy-components/src/article-card/article-card.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
import { Link } from "@reach/router"
import { format as formatDate } from 'date-fns'
import React from "react"
import ResponsiveImage from '../responsive-image'

export default function articleCard({ article, linkImplementation = Link, withBody = true, withImage = true, withDate = true }) {

const date = new Date(article.date)
const LinkImplementation = linkImplementation
import { Link } from "@reach/router";
import { format as formatDate } from "date-fns";
import React from "react";
import ResponsiveImage from "../responsive-image";

export function ArticleCard({
article,
linkImplementation = Link,
withBody = true,
withImage = true,
withDate = true,
}) {
const date = new Date(article.date);
const LinkImplementation = linkImplementation;

return (
<div className="alex-card">

<div className="alex-card__content--container">

<div className="alex-card__title">
<h3><LinkImplementation to={article.slug}>{article.title}</LinkImplementation></h3>
<h3>
<LinkImplementation to={article.slug}>
{article.title}
</LinkImplementation>
</h3>
</div>

{(withBody !== false) ?
{withBody !== false ? (
<div className="alex-card__abstract">
<p>
{article.content.excerpt}
</p>
<p>{article.content.excerpt}</p>
</div>
: null}
) : null}

{(withDate !== false) ?
{withDate !== false ? (
<div className="alex-card__timetamp">
<span className="dateline">
<time dateTime={date.toISOString()}>{formatDate(date, "d MMM yyyy")}</time>
<time dateTime={date.toISOString()}>
{formatDate(date, "d MMM yyyy")}
</time>
</span>
</div>
: null}

) : null}
</div>

{(withImage !== false && article.image && article.image.thumbnail) ?
{withImage !== false && article.image && article.image.thumbnail ? (
<div className="alex-card__image">
<ResponsiveImage src={article.image.thumbnail} width={400} />
</div>
: null}

) : null}
</div>
)

);
}

export default ArticleCard;
8 changes: 4 additions & 4 deletions components/legacy-components/src/responsive-image/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './responsive-image.scss'
import ResponsiveImage from './responsive-image'
export {ResponsiveImage}
export default ResponsiveImage
import "./responsive-image.scss";
import ResponsiveImage from "./responsive-image";
export { ResponsiveImage };
export default ResponsiveImage;
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
import React from 'react'
import React from "react";

export default function responsiveImage({src, alt, width, height, quality, format, className}) {

const queryParams = []
if (Number.isInteger(width)) queryParams.push(`width=${width}`)
if (Number.isInteger(height)) queryParams.push(`height=${height}`)
export function ResponsiveImage({
src,
alt,
width,
height,
quality,
format,
className,
}) {
const queryParams = [];
if (Number.isInteger(width)) queryParams.push(`width=${width}`);
if (Number.isInteger(height)) queryParams.push(`height=${height}`);

if (quality) {
queryParams.push(`quality=${quality}`)
queryParams.push(`quality=${quality}`);
}

if (format) {
queryParams.push(`format=${format}`)
queryParams.push(`format=${format}`);
}

return (
<img
src={`https://imagecdn.app/v2/image/${encodeURIComponent(src)}?${queryParams.join('&')}`}
className={`responsive-image ${className}`}
alt={alt}
src={`https://imagecdn.app/v2/image/${encodeURIComponent(src)}?${queryParams.join("&")}`}
className={`responsive-image ${className}`}
alt={alt}
/>
)
);
}

export default ResponsiveImage;
27 changes: 25 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7066a85

Please sign in to comment.