Skip to content

Commit

Permalink
Merge pull request #47 from 46ki75/release/v0.2.2
Browse files Browse the repository at this point in the history
Release/v0.2.2
  • Loading branch information
46ki75 authored Oct 27, 2024
2 parents 67a8e56 + 950be1e commit 0da0529
Show file tree
Hide file tree
Showing 11 changed files with 1,448 additions and 953 deletions.
2,006 changes: 1,076 additions & 930 deletions package-lock.json

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "relmethis",
"version": "0.2.1",
"version": "0.2.2",
"author": "Chomolungma Shirayuki",
"repository": {
"type": "git",
Expand Down Expand Up @@ -57,41 +57,41 @@
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^2.0.2",
"@storybook/addon-a11y": "^8.3.0",
"@storybook/addon-essentials": "^8.3.0",
"@storybook/addon-interactions": "^8.3.0",
"@storybook/addon-links": "^8.3.0",
"@storybook/addon-onboarding": "^8.3.0",
"@chromatic-com/storybook": "^3.1.0",
"@storybook/addon-a11y": "^8.3.6",
"@storybook/addon-essentials": "^8.3.6",
"@storybook/addon-interactions": "^8.3.6",
"@storybook/addon-links": "^8.3.6",
"@storybook/addon-onboarding": "^8.3.6",
"@storybook/blocks": "^8.3.0",
"@storybook/react": "^8.3.0",
"@storybook/react-vite": "^8.3.0",
"@storybook/react": "^8.3.6",
"@storybook/react-vite": "^8.3.6",
"@storybook/test": "^8.3.0",
"@types/katex": "^0.16.7",
"@types/mdast": "^4.0.4",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/prismjs": "^1.26.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-helmet": "^6.1.11",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/react-transition-group": "^4.4.11",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"@vitejs/plugin-react-swc": "^3.7.1",
"csstype": "^3.1.3",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"eslint-plugin-storybook": "^0.9.0",
"eslint": "^9.13.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-storybook": "^0.10.1",
"postcss": "^8.4.47",
"postcss-preset-env": "^10.0.5",
"postcss-preset-env": "^10.0.8",
"prettier": "^3.3.2",
"sass": "^1.79.4",
"sass": "^1.80.4",
"storybook": "^8.3.0",
"typescript": "^5.6.2",
"vite": "^5.4.4",
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vite-plugin-css-injected-by-js": "^3.5.2",
"vite-plugin-dts": "^4.2.3"
"vite-plugin-dts": "^4.3.0"
},
"volta": {
"node": "22.9.0"
Expand Down
Binary file added public/images/bg1.webp
Binary file not shown.
Binary file added public/images/bg2.webp
Binary file not shown.
4 changes: 4 additions & 0 deletions src/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// media breakpoints
$breakpoint-mobile: 576px;
$breakpoint-tablet: 768px;
$breakpoint-desktop: 992px;
10 changes: 10 additions & 0 deletions src/components/containment/Parallax.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.parallax {
position: fixed;
height: 2000vh;
width: 100%;
top: 0;
left: 0;
z-index: -1;
background-repeat: repeat;
background-size: auto;
}
31 changes: 31 additions & 0 deletions src/components/containment/Parallax.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { Meta, StoryObj } from '@storybook/react'
import { Parallax } from './Parallax'

const meta: Meta<typeof Parallax> = {
title: 'Components/Containment/Parallax',
component: Parallax,
tags: ['autodocs']
}

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
render: (args) => {
return (
<div style={{ width: '100%' }}>
<Parallax {...args} />
{new Array(100).fill(0).map((_, i) => (
<h1 key={i} style={{ color: 'gray' }}>
TEXT CONTENT {i}
</h1>
))}
</div>
)
},
args: {
isDark: false,
imageUrl1: '/images/bg1.webp',
imageUrl2: '/images/bg2.webp'
}
}
72 changes: 72 additions & 0 deletions src/components/containment/Parallax.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import React from 'react'
import isEqual from 'react-fast-compare'
import styles from './Parallax.module.scss'
import { useWindowScroll } from 'react-use'

// # --------------------------------------------------------------------------------
//
// props
//
// # --------------------------------------------------------------------------------

export interface ParallaxProps {
style?: React.CSSProperties

/**
* Whether or not to use the dark theme
*/
isDark?: boolean

imageUrl1: string

imageUrl2: string
}

// # --------------------------------------------------------------------------------
//
// component
//
// # --------------------------------------------------------------------------------

const ParallaxComponent = ({
style,
isDark = typeof window !== 'undefined'
? window.matchMedia('(prefers-color-scheme: dark)').matches
: false,
imageUrl1,
imageUrl2
}: ParallaxProps) => {
const { y } = useWindowScroll()
const opacity = isDark ? 0.08 : 0.5
return (
<>
<div
className={styles.parallax}
style={{
backgroundImage: `url(${imageUrl1})`,
transform: `scale(1.2) translateY(${y / 400}%)`,
transformOrigin: 'bottom',
opacity,
...style
}}
></div>
<div
className={styles.parallax}
style={{
backgroundImage: `url(${imageUrl2})`,
transform: `scale(1.2) translateY(${y / 900}%)`,
transformOrigin: 'bottom',
opacity
}}
></div>
</>
)
}

// # --------------------------------------------------------------------------------
//
// memoize
//
// # --------------------------------------------------------------------------------

export const Parallax = React.memo(ParallaxComponent, isEqual)
72 changes: 72 additions & 0 deletions src/components/navigation/ArticleCard.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@use '../../mixins';
@use '../../variables';

.card {
all: unset;
position: relative;

height: 100%;
width: 100%;

display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;

box-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.1);

cursor: pointer;

transition:
opacity 400ms,
background-color 400ms,
transform 200ms;

@include mixins.fade-in();

@media (max-width: variables.$breakpoint-mobile) {
width: 100%;
max-width: 100%;
}

@media (min-width: variables.$breakpoint-mobile) and (max-width: variables.$breakpoint-desktop) {
box-sizing: border-box;
width: calc(50% - 0.5rem);
}

&:hover {
transform: translateX(-2px) translateY(-2px);
background-color: rgba($color: #6987b8, $alpha: 0.2);
}

&:active {
transform: translateX(2px) translateY(2px);
background-color: rgba($color: #b8a36e, $alpha: 0.2);
}

&__typography {
box-sizing: border-box;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
padding: 0.5rem;
gap: 0.25rem;
}

&__date {
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
gap: 0.5rem;
}

&__icon {
width: 16px;
height: 16px;
opacity: 0.6;
}
}
25 changes: 25 additions & 0 deletions src/components/navigation/ArticleCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { Meta, StoryObj } from '@storybook/react'
import { ArticleCard } from './ArticleCard'

const meta: Meta<typeof ArticleCard> = {
title: 'Components/Navigation/ArticleCard',
component: ArticleCard,
tags: ['autodocs']
}

export default meta
type Story = StoryObj<typeof meta>

export const Placeholder: Story = {
args: {
isDark: false,
maxWidth: '520px',
title: 'Placeholder Title',
description:
'This is a placeholder description for the ArticleCard component.',
image:
'https://web-toolbox.dev/__og-image__/static/en/tools/ogp-checker/og.png',
createdAt: '2023-10-01',
updatedAt: '2023-10-01'
}
}
Loading

0 comments on commit 0da0529

Please sign in to comment.