-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unify feed card styles into a pattern
- Loading branch information
1 parent
64af0c3
commit d6a32c1
Showing
15 changed files
with
119 additions
and
30 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
import { PropsWithChildren } from "react"; | ||
|
||
import { styled } from "@/styled-system/jsx"; | ||
import { Card } from "@/styled-system/patterns"; | ||
|
||
export function FeedItem({ children }: PropsWithChildren) { | ||
return ( | ||
<styled.article | ||
display="flex" | ||
flexDir="column" | ||
width="full" | ||
p="2" | ||
gap="2" | ||
boxShadow="md" | ||
borderRadius="md" | ||
backgroundColor="white" | ||
> | ||
{children} | ||
</styled.article> | ||
); | ||
return <styled.article className={Card()}>{children}</styled.article>; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint-disable */ | ||
import type { FunctionComponent } from 'react' | ||
import type { CardProperties } from '../patterns/card'; | ||
import type { HTMLStyledProps } from '../types/jsx'; | ||
import type { DistributiveOmit } from '../types/system-types'; | ||
|
||
export interface CardProps extends CardProperties, DistributiveOmit<HTMLStyledProps<'div'>, keyof CardProperties > {} | ||
|
||
/** A card component that can be used to display content in a container with a border and a shadow. */ | ||
export declare const Card: FunctionComponent<CardProps> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createElement, forwardRef } from 'react' | ||
import { styled } from './factory.mjs'; | ||
import { getCardStyle } from '../patterns/card.mjs'; | ||
|
||
export const Card = /* @__PURE__ */ forwardRef(function Card(props, ref) { | ||
const { kind, ...restProps } = props | ||
const styleProps = getCardStyle({kind}) | ||
return createElement(styled.div, { ref, ...styleProps, ...restProps }) | ||
}) |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable */ | ||
import type { SystemStyleObject, ConditionalValue } from '../types/index'; | ||
import type { Properties } from '../types/csstype'; | ||
import type { PropertyValue } from '../types/prop-type'; | ||
import type { DistributiveOmit } from '../types/system-types'; | ||
import type { Tokens } from '../tokens/index'; | ||
|
||
export interface CardProperties { | ||
kind?: ConditionalValue<"edge" | "default"> | ||
} | ||
|
||
|
||
interface CardStyles extends CardProperties, DistributiveOmit<SystemStyleObject, keyof CardProperties > {} | ||
|
||
interface CardPatternFn { | ||
(styles?: CardStyles): string | ||
raw: (styles?: CardStyles) => SystemStyleObject | ||
} | ||
|
||
/** A card component that can be used to display content in a container with a border and a shadow. */ | ||
export declare const Card: CardPatternFn; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { mapObject } from '../helpers.mjs'; | ||
import { css } from '../css/index.mjs'; | ||
|
||
const CardConfig = { | ||
transform(props) { | ||
const { kind } = props; | ||
const padding = kind === "edge" ? "0" : "2"; | ||
return { | ||
display: "flex", | ||
flexDirection: "column", | ||
gap: "2", | ||
width: "full", | ||
boxShadow: "sm", | ||
borderRadius: "lg", | ||
backgroundColor: "bg.default", | ||
padding | ||
}; | ||
}} | ||
|
||
export const getCardStyle = (styles = {}) => CardConfig.transform(styles, { map: mapObject }) | ||
|
||
export const Card = (styles) => css(getCardStyle(styles)) | ||
Card.raw = getCardStyle |
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
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
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
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
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
Oops, something went wrong.
d6a32c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
storyden-homepage – ./home
storyden-homepage.vercel.app
storyden-homepage-southclaws.vercel.app
storyden-homepage-git-main-southclaws.vercel.app
www.storyden.org
storyden.org