Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/wethegit-components/src/components/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export * from "./breakpoint-snipe"

Check failure on line 1 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './breakpoint-snipe'

Check failure on line 1 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './breakpoint-snipe'
export * from "./flex"

Check failure on line 2 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './flex'

Check failure on line 2 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './flex'
export * from "./grid-layout"

Check failure on line 3 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './grid-layout'

Check failure on line 3 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './grid-layout'
export * from "./icon"

Check failure on line 4 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './icon'

Check failure on line 4 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './icon'
export * from "./image-group"

Check failure on line 5 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './image-group'

Check failure on line 5 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './image-group'
export * from "./in-view"

Check failure on line 6 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './in-view'

Check failure on line 6 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './in-view'
export * from "./modal"

Check failure on line 7 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './modal'

Check failure on line 7 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './modal'
export * from "./navigation"
export * from "./masked-edge"

Check failure on line 9 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './masked-edge'

Check failure on line 9 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './masked-edge'
export * from "./tag"

Check failure on line 10 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './tag'

Check failure on line 10 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unable to resolve path to module './tag'
export * from "./text"

Check failure on line 11 in packages/wethegit-components/src/components/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module './text'
export * from "./visually-hidden"
export * from "./visually-hidden-links"
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.maskedEdge {
position: relative;
}

.maskSizer {
/* For container units */
container-type: size;
inset: 0;
pointer-events: none;
position: absolute;
}

/* Holds the inline SVG mask without taking up space */
.maskDefs {
height: 0;
overflow: hidden;
pointer-events: none;
position: absolute;
width: 0;
}

.maskedContent {
position: relative;
}

.fullFrame {
inset: 0;
overflow: hidden;
position: absolute;
}

/* Move mask to edge */
.edgeBottom {
transform: translateY(calc(100cqh - var(--masked-edge-size)));
}

.edgeRight {
transform: translateX(calc(100cqw - var(--masked-edge-size)));
}

.maskImage {
transform-box: fill-box;
transform-origin: center;
}

.mirrorX {
transform: scaleX(-1);
}

.mirrorY {
transform: scaleY(-1);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a few linting issues due to the name property being used on some of these stories. Let's clean those up and see if we can get CI to pass.

Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
import type { CSSProperties, ReactNode } from "react"
import type { Meta, StoryObj } from "@storybook/react"

import { MaskedEdge } from "./masked-edge"

const pageStyle: CSSProperties = {
background: "#e6f5ff",
backgroundImage: 'url("/masked-edge-demo/rpg-fight-bg.gif")',
backgroundSize: "cover",
display: "flex",
flexWrap: "wrap",
padding: 32,
width: "fit-content",
}

const cardStyle: CSSProperties = {
background: "#bb3eac",
color: "#fff",
maxWidth: 460,
padding: "88px 40px",
}

const narrowCardStyle: CSSProperties = {
...cardStyle,
maxWidth: 560,
padding: "32px 72px",
}

const framePanelStyle: CSSProperties = {
display: "flex",
flexDirection: "column",
}

function CardContent() {
return (
<>
<h3 style={{ margin: "0 0 8px" }}>A masked edge</h3>
<p style={{ margin: 0 }}>
Use opaque artwork to cut out the edges of the container.
</p>
</>
)
}

function Scene({ children }: { children: ReactNode }) {
return <div style={pageStyle}>{children}</div>
}

const meta: Meta<typeof MaskedEdge> = {
component: MaskedEdge,
title: "components/masked-edge",
}

export default meta

type Story = StoryObj<typeof MaskedEdge>

export const Top: Story = {
render: () => (
<Scene>
<MaskedEdge top="/masked-edge-demo/crumb-border.svg" size={30} style={cardStyle}>
<CardContent />
</MaskedEdge>
</Scene>
),
}

export const Bottom: Story = {
render: () => (
<Scene>
<MaskedEdge
bottom="/masked-edge-demo/crumb-border.svg"
mirror
size={30}
style={cardStyle}
>
<CardContent />
</MaskedEdge>
</Scene>
),
}

export const TopAndBottomMirror: Story = {
render: () => (
<Scene>
<MaskedEdge
image="/masked-edge-demo/crumb-border.svg"
sides="top bottom"
mirror
size={30}
style={cardStyle}
>
<CardContent />
</MaskedEdge>
</Scene>
),
}

export const TopAndBottom: Story = {
render: () => (
<Scene>
<MaskedEdge
top="/masked-edge-demo/crumb-border.svg"
bottom="/masked-edge-demo/crumb-border-bottom.png"
size={30}
style={cardStyle}
>
<CardContent />
</MaskedEdge>
</Scene>
),
}

export const Right: Story = {
render: () => (
<Scene>
<MaskedEdge
right="/masked-edge-demo/edge-pattern-bite-vertical.png"
mirror
size={80}
style={narrowCardStyle}
>
<CardContent />
<p>
One asset set on the right and mirrored to flip it the desired direction. Repeat
is not set, therefore the masked asset will stretch.
</p>
</MaskedEdge>
</Scene>
),
}

export const LeftAndRight: Story = {
render: () => (
<Scene>
<MaskedEdge
image="/masked-edge-demo/edge-pattern-bite-vertical.png"
sides="left right"
mirror
size={80}
style={narrowCardStyle}
>
<CardContent />
<p>
One asset set to the left and right, mirrored. They will stretch to the ends of
the container if <u>repeat</u> is not set to tile the asset.
</p>
</MaskedEdge>
</Scene>
),
}

export const Repeat: Story = {
render: () => (
<Scene>
<MaskedEdge
image="/masked-edge-demo/edge-pattern.png"
sides="top bottom"
repeat
tileSize={100}
size={40}
mirror
style={{ ...cardStyle, padding: 100 }}
>
<CardContent />
<p>
A pattern set to the top and bottom edge and repeating. We can adjust the tile
size or limit to a single side.
</p>
</MaskedEdge>
</Scene>
),
}

export const FullFrame169: Story = {
render: () => (
<Scene>
<div style={{ maxWidth: 500, width: "40vw" }}>
<MaskedEdge image="/masked-edge-demo/frame-16-9.png" fullFrame>
<div style={framePanelStyle}>
<img src="/masked-edge-demo/water-animated.gif" alt="" />
</div>
</MaskedEdge>
</div>
</Scene>
),
}

export const FullFrame11: Story = {
render: () => (
<Scene>
<div style={{ maxWidth: 400, width: "40vw" }}>
<MaskedEdge image="/masked-edge-demo/frame-1-1.png" fullFrame frameAspect="1 / 1">
<div style={framePanelStyle}>
<img src="/masked-edge-demo/animated-1-1.gif" alt="" />
</div>
</MaskedEdge>
</div>
</Scene>
),
}
Loading
Loading