Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 2 additions & 3 deletions .pnp.cjs

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

27 changes: 27 additions & 0 deletions ui-parts/icons/src/icons/image-placeholder.icon.tsx
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'
Comment thread
comfrt1k marked this conversation as resolved.
Resolved
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>
)
1 change: 1 addition & 0 deletions ui-parts/icons/src/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './cross.icon.js'
export * from './email.icon.js'
export * from './eye-closed.icon.js'
export * from './eye.icon.js'
export * from './image-placeholder.icon.js'
export * from './lock.icon.js'
export * from './phone.icon.js'
export * from './search.icon.js'
16 changes: 16 additions & 0 deletions ui-parts/icons/svg/image-placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions ui-parts/placeholder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
"postpack": "rm -rf dist"
},
"dependencies": {
"@atls-ui-parts/layout": "workspace:*",
"@atls-ui-parts/text": "workspace:*",
"@atls-ui-parts/theme": "workspace:*",
"@atls-ui/theme": "workspace:*",
"clsx": "2.1.1"
},
"devDependencies": {
"@atls-ui-parts/condition": "workspace:*",
"@atls-ui-parts/icons": "workspace:*",
"@storybook/react": "10.4.6",
"@types/react": "19.1.2",
"@vanilla-extract/css": "1.17.1",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 11 additions & 0 deletions ui-parts/placeholder/src/container/base.css.ts
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',
})
39 changes: 39 additions & 0 deletions ui-parts/placeholder/src/container/component.tsx
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>
)
2 changes: 2 additions & 0 deletions ui-parts/placeholder/src/container/index.ts
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'
12 changes: 12 additions & 0 deletions ui-parts/placeholder/src/container/interfaces.ts
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
}
42 changes: 42 additions & 0 deletions ui-parts/placeholder/src/container/position.css.ts
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
23 changes: 23 additions & 0 deletions ui-parts/placeholder/src/container/position.ts
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)]
7 changes: 7 additions & 0 deletions ui-parts/placeholder/src/description/appearance.css.ts
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,
})
5 changes: 5 additions & 0 deletions ui-parts/placeholder/src/description/base.css.ts
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',
})
22 changes: 22 additions & 0 deletions ui-parts/placeholder/src/description/component.tsx
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>
)
2 changes: 2 additions & 0 deletions ui-parts/placeholder/src/description/index.ts
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'
5 changes: 5 additions & 0 deletions ui-parts/placeholder/src/description/interfaces.ts
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
}
7 changes: 7 additions & 0 deletions ui-parts/placeholder/src/icon/appearance.css.ts
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,
})
15 changes: 15 additions & 0 deletions ui-parts/placeholder/src/icon/base.css.ts
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%',
})
14 changes: 14 additions & 0 deletions ui-parts/placeholder/src/icon/component.tsx
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>
)
2 changes: 2 additions & 0 deletions ui-parts/placeholder/src/icon/index.ts
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'
5 changes: 5 additions & 0 deletions ui-parts/placeholder/src/icon/interfaces.ts
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.

2 changes: 0 additions & 2 deletions ui-parts/placeholder/src/image-box-placeholder/index.ts

This file was deleted.

Loading
Loading