Repository navigation
Feat delete placeholder #821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
4b212b6
816854e
6435df1
7805a08
d013d96
7297354
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type { ReactNode } from 'react' | ||
|
|
||
| import type { IconProps } from '../icons.interfaces.js' | ||
|
|
||
| export const ImagePlaceholderIcon = (props: IconProps): ReactNode => ( | ||
| <svg | ||
| xmlns='http://www.w3.org/2000/svg' | ||
| width='1em' | ||
| height='1em' | ||
| fill='none' | ||
| viewBox='0 0 120 98' | ||
| {...props} | ||
| > | ||
| <path fill='#DADFE8' d='M0 0h120v98H0z' /> | ||
| <path fill='#F8F9FF' d='M-385-59h943v427h-943z' /> | ||
| <path | ||
| fill='#0C0F1E' | ||
| d='M96.6 32.114c3.645 0 6.6-2.97 6.6-6.634s-2.955-6.634-6.6-6.634-6.6 2.97-6.6 6.634 2.955 6.634 6.6 6.634' | ||
| /> | ||
| <path stroke='#0C0F1E' d='M117 3.77H3v90.46h114z' /> | ||
| <path | ||
| stroke='#0C0F1E' | ||
| strokeWidth={1.01} | ||
| d='M24 67.092 48 42.97l30 30.154M66 61.062l9-9.047 21 21.108' | ||
| /> | ||
| </svg> | ||
| ) | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { style } from '@vanilla-extract/css' | ||
|
|
||
| import { placeholderAppearanceVariables } from '../styles/appearance/styles.css.js' | ||
|
|
||
| export const containerBaseStyles = style({ | ||
| alignItems: 'center', | ||
| backgroundColor: placeholderAppearanceVariables.backgroundColor, | ||
| boxSizing: 'border-box', | ||
| display: 'grid', | ||
| width: 'fit-content', | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import type { ReactNode } from 'react' | ||
|
|
||
| import type { ContainerProps } from './interfaces.js' | ||
|
|
||
| import { clsx } from 'clsx' | ||
|
|
||
| import { containerBaseStyles } from './base.css.js' | ||
| import { getContainerPositionStyles } from './position.js' | ||
|
|
||
| export const Container = ({ | ||
| children, | ||
| className, | ||
| hasDescription, | ||
| hasTitle, | ||
| horizontalMinHeight, | ||
| ref, | ||
| style, | ||
| textPosition, | ||
| ...props | ||
| }: ContainerProps): ReactNode => ( | ||
| <div | ||
| ref={ref} | ||
| {...props} | ||
| className={clsx( | ||
| containerBaseStyles, | ||
| getContainerPositionStyles(textPosition, hasTitle, hasDescription), | ||
| className | ||
| )} | ||
| style={{ | ||
| minHeight: | ||
| (textPosition === 'left' || textPosition === 'right') && (hasTitle || hasDescription) | ||
| ? horizontalMinHeight | ||
| : undefined, | ||
| ...style, | ||
| }} | ||
| > | ||
| {children} | ||
| </div> | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { Container } from './component.js' | ||
| export type { ContainerProps } from './interfaces.js' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import type { HTMLAttributes } from 'react' | ||
| import type { Ref } from 'react' | ||
|
|
||
| import type { PlaceholderTextPosition } from '../placeholder.interfaces.js' | ||
|
|
||
| export interface ContainerProps extends HTMLAttributes<HTMLDivElement> { | ||
| hasDescription: boolean | ||
| hasTitle: boolean | ||
| horizontalMinHeight: string | ||
| ref?: Ref<HTMLDivElement> | ||
| textPosition: PlaceholderTextPosition | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { styleVariants } from '@vanilla-extract/css' | ||
|
|
||
| export const containerPositionStyles = { | ||
| bottom: styleVariants({ | ||
| none: { gridTemplateAreas: '"icon"', justifyItems: 'center' }, | ||
| title: { gridTemplateAreas: '"icon" "title"', justifyItems: 'center' }, | ||
| description: { gridTemplateAreas: '"icon" "description"', justifyItems: 'center' }, | ||
| titleDescription: { | ||
| gridTemplateAreas: '"icon" "title" "description"', | ||
| justifyItems: 'center', | ||
| }, | ||
| }), | ||
| left: styleVariants({ | ||
| none: { gridTemplateAreas: '"icon"', justifyItems: 'center' }, | ||
| title: { gridTemplateAreas: '"title icon"', justifyItems: 'end' }, | ||
| description: { gridTemplateAreas: '"description icon"', justifyItems: 'end' }, | ||
| titleDescription: { | ||
| alignContent: 'center', | ||
| gridTemplateAreas: '"title icon" "description icon"', | ||
| justifyItems: 'end', | ||
| }, | ||
| }), | ||
| right: styleVariants({ | ||
| none: { gridTemplateAreas: '"icon"', justifyItems: 'center' }, | ||
| title: { gridTemplateAreas: '"icon title"', justifyItems: 'start' }, | ||
| description: { gridTemplateAreas: '"icon description"', justifyItems: 'start' }, | ||
| titleDescription: { | ||
| alignContent: 'center', | ||
| gridTemplateAreas: '"icon title" "icon description"', | ||
| justifyItems: 'start', | ||
| }, | ||
| }), | ||
| top: styleVariants({ | ||
| none: { gridTemplateAreas: '"icon"', justifyItems: 'center' }, | ||
| title: { gridTemplateAreas: '"title" "icon"', justifyItems: 'center' }, | ||
| description: { gridTemplateAreas: '"description" "icon"', justifyItems: 'center' }, | ||
| titleDescription: { | ||
| gridTemplateAreas: '"title" "description" "icon"', | ||
| justifyItems: 'center', | ||
| }, | ||
| }), | ||
| } as const |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import type { PlaceholderTextPosition } from '../placeholder.interfaces.js' | ||
|
|
||
| import { containerPositionStyles } from './position.css.js' | ||
|
|
||
| type PlaceholderContent = 'description' | 'none' | 'title' | 'titleDescription' | ||
|
|
||
| const contentKey = (hasTitle: boolean, hasDescription: boolean): PlaceholderContent => { | ||
| if (hasTitle && hasDescription) { | ||
| return 'titleDescription' | ||
| } | ||
|
|
||
| if (hasTitle) { | ||
| return 'title' | ||
| } | ||
|
|
||
| return hasDescription ? 'description' : 'none' | ||
| } | ||
|
|
||
| export const getContainerPositionStyles = ( | ||
| textPosition: PlaceholderTextPosition, | ||
| hasTitle: boolean, | ||
| hasDescription: boolean | ||
| ): string => containerPositionStyles[textPosition][contentKey(hasTitle, hasDescription)] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { style } from '@vanilla-extract/css' | ||
|
|
||
| import { placeholderAppearanceVariables } from '../styles/appearance/styles.css.js' | ||
|
|
||
| export const descriptionAppearanceStyles = style({ | ||
| color: placeholderAppearanceVariables.descriptionColor, | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { style } from '@vanilla-extract/css' | ||
|
|
||
| export const descriptionBaseStyles = style({ | ||
| gridArea: 'description', | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import type { ReactNode } from 'react' | ||
|
|
||
| import type { DescriptionProps } from './interfaces.js' | ||
|
|
||
| import { clsx } from 'clsx' | ||
|
|
||
| import { descriptionAppearanceStyles } from './appearance.css.js' | ||
| import { descriptionBaseStyles } from './base.css.js' | ||
|
|
||
| export const Description = ({ | ||
| children, | ||
| className, | ||
| shape, | ||
| ...props | ||
| }: DescriptionProps): ReactNode => ( | ||
| <span | ||
| {...props} | ||
| className={clsx(descriptionBaseStyles, descriptionAppearanceStyles, shape, className)} | ||
| > | ||
| {children} | ||
| </span> | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { Description } from './component.js' | ||
| export type { DescriptionProps } from './interfaces.js' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import type { HTMLAttributes } from 'react' | ||
|
|
||
| export interface DescriptionProps extends HTMLAttributes<HTMLSpanElement> { | ||
| shape: string | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { style } from '@vanilla-extract/css' | ||
|
|
||
| import { placeholderAppearanceVariables } from '../styles/appearance/styles.css.js' | ||
|
|
||
| export const iconAppearanceStyles = style({ | ||
| color: placeholderAppearanceVariables.iconColor, | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { globalStyle } from '@vanilla-extract/css' | ||
| import { style } from '@vanilla-extract/css' | ||
|
|
||
| export const iconBaseStyles = style({ | ||
| alignItems: 'center', | ||
| display: 'inline-flex', | ||
| gridArea: 'icon', | ||
| justifyContent: 'center', | ||
| lineHeight: 1, | ||
| }) | ||
|
|
||
| globalStyle(`${iconBaseStyles} > svg`, { | ||
| height: '100%', | ||
| width: '100%', | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import type { ReactNode } from 'react' | ||
|
|
||
| import type { IconProps } from './interfaces.js' | ||
|
|
||
| import { clsx } from 'clsx' | ||
|
|
||
| import { iconAppearanceStyles } from './appearance.css.js' | ||
| import { iconBaseStyles } from './base.css.js' | ||
|
|
||
| export const Icon = ({ children, className, shape, ...props }: IconProps): ReactNode => ( | ||
| <span {...props} className={clsx(iconBaseStyles, iconAppearanceStyles, shape, className)}> | ||
| {children} | ||
| </span> | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { Icon } from './component.js' | ||
| export type { IconProps } from './interfaces.js' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import type { HTMLAttributes } from 'react' | ||
|
|
||
| export interface IconProps extends HTMLAttributes<HTMLSpanElement> { | ||
| shape: string | ||
| } |
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.