Repository navigation
Feat/redesign image #835
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
Merged
Merged
Feat/redesign image #835
Changes from 9 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
062f7d2
feat(tooltip)!: redesign tooltip component
comfrt1k 8486814
docs(tooltip): update story for redesigned component
comfrt1k 1d8eb90
fix(components): update tooltip generator template
comfrt1k 70e11c2
chore(tooltip): format
comfrt1k 8daf5bb
fix(tooltip): wrap long unbroken text
comfrt1k 89beaa0
Merge pull request #822 from atls/feat/redesign-tooltip
TorinAsakura 72e20de
refactor(progress): share theme shadow tokens
comfrt1k b9ea605
refactor(progress): reserve percentage label space in CSS
comfrt1k 8b03763
refactor(progress): reuse the default circle box shape
comfrt1k 0ccdd11
refactor(progress): render circle segments on a shared SVG track
comfrt1k 1670a4c
refactor(progress): animate circle segments with CSS keyframes
comfrt1k 626d77a
refactor(progress): animate linear segments with CSS keyframes
comfrt1k 0bef69e
refactor(progress): use the spacing token for circle padding
comfrt1k a0143f8
refactor(progress): colocate stories with each progress variant
comfrt1k 6384104
refactor(progress): use theme tokens for motion and opacity
comfrt1k 9bb39a6
refactor(progress): extract full radius constant
comfrt1k c9fe6e2
feat(theme): add spacing token for circle progress padding
comfrt1k 832485a
refactor(progress): extract built-in animation constants
comfrt1k 912570f
refactor(progress): extract story animation constants
comfrt1k 7e53a6b
fix(icons): generate components with native SVG props
comfrt1k 552fc73
feat(icons): add placeholder icon
comfrt1k f89945f
build(image): add theme progress and storybook dependencies
comfrt1k f6646fa
feat(image): add configurable container styles
comfrt1k 352822f
feat(image): add configurable picture fit styles
comfrt1k 92e60e0
feat(image): add themed responsive fallback styles
comfrt1k 72a93b0
feat(image): add configurable loading overlay styles
comfrt1k 4643b83
feat(image)!: compose native image loading and fallback states
comfrt1k 64ccd73
docs(image): add interactive story for image states
comfrt1k 4a8ef15
fix(icons): restore sprinkle-aware generation
comfrt1k de2ce6b
build(npm): declare Hyperion package repositories
TorinAsakura 61979fe
ci(npm): publish workspaces with applied Yarn versions
TorinAsakura 99a0d12
ci(npm): preserve the shared release flow
TorinAsakura cd90953
feat(workflows): update
atlantis-terraformer-bot[bot] ef6e6c4
Merge commit 'cd9095316a8f82aa74ef4689a000115b1215a9bc' into build/np…
TorinAsakura 55b4d20
Merge pull request #837 from atls/build/npm-trusted-publishing
TorinAsakura 7d53d50
chore(release): publish workspace versions
atlantis-courier[bot] 4732249
test(text-transform): verify transformations without a browser
TorinAsakura ae2ab26
Merge pull request #838 from atls/test/text-transform-node
TorinAsakura ad5fd61
chore(release): publish workspace versions
atlantis-courier[bot] b12fac5
feat(workflows): update
atlantis-terraformer-bot[bot] f0736e3
chore: synchronize v2 with master
TorinAsakura b6b50ba
fix(image): stabilize callback ref declarations
TorinAsakura 77b5721
chore(progress): integrate current v2
TorinAsakura bdf8684
chore(modals): integrate current stack base
TorinAsakura c24471a
chore(link): integrate current stack base
TorinAsakura f36de38
chore(avatar): integrate current stack base
TorinAsakura 84fd39a
chore(image): integrate current stack base
TorinAsakura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,21 +1,11 @@ | ||
| import type { Config } from '@svgr/core' | ||
|
|
||
| export const svgrTemplate: Config['template'] = ({ jsx, componentName }, { tpl }) => tpl` | ||
| import type { IconProps } from '../icons.interfaces.js' | ||
|
|
||
| import type { ReactNode } from 'react' | ||
|
|
||
| import { clsx } from 'clsx' | ||
|
|
||
| import { iconSprinkles } from '../icon.css.js' | ||
|
|
||
| export const ${componentName} = (props: IconProps): ReactNode => { | ||
| const { className, style, otherProps } = iconSprinkles(props) | ||
|
|
||
| const iconStyle = { ...style, ...otherProps.style } | ||
| import type { IconProps } from '../icons.interfaces.js' | ||
|
|
||
| return ( | ||
| ${jsx} | ||
| ) | ||
| } | ||
| export const ${componentName} = (props: IconProps): ReactNode => ( | ||
| ${jsx} | ||
| ) | ||
| ` | ||
This file contains hidden or 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 hidden or 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 @@ | ||
| import type { ReactNode } from 'react' | ||
|
|
||
| import type { IconProps } from '../icons.interfaces.js' | ||
| export const PlaceholderIcon = (props: IconProps): ReactNode => ( | ||
| <svg | ||
| xmlns='http://www.w3.org/2000/svg' | ||
| width='1em' | ||
| height='1em' | ||
| fill='none' | ||
| viewBox='0 0 100 81' | ||
| {...props} | ||
| > | ||
| <path | ||
| fill='currentColor' | ||
| d='M80.5 26.543c3.038 0 5.5-2.455 5.5-5.483s-2.462-5.483-5.5-5.483S75 18.032 75 21.06s2.462 5.483 5.5 5.483' | ||
| /> | ||
| <path stroke='currentColor' d='M2.5 3.115h95v74.77h-95z' /> | ||
| <path stroke='currentColor' strokeWidth={1.01} d='m20 55.454 20-19.939 25 24.923' /> | ||
| <path stroke='currentColor' strokeWidth={1.01} d='m55 50.47 7.5-7.478L80 60.44' /> | ||
| </svg> | ||
| ) |
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.
This file contains hidden or 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 hidden or 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,91 @@ | ||
| 'use client' | ||
|
|
||
| /* eslint-disable @next/next/no-img-element */ | ||
| import type { ImageProps } from './interfaces.js' | ||
| import { clsx } from 'clsx' | ||
|
|
||
| import { PlaceholderIcon } from '@atls-ui-parts/icons' | ||
| import { CircleProgress } from '@atls-ui-parts/progress' | ||
|
|
||
| import { containerStyles } from './container/styles/base.css.js' | ||
| import { fallbackStyles } from './fallback/styles/base.css.js' | ||
| import { fallbackIconStyles } from './fallback/styles/base.css.js' | ||
| import { descriptionStyles } from './fallback/styles/base.css.js' | ||
| import { loadingStyles } from './loading/styles/base.css.js' | ||
| import { pictureStyles } from './picture/styles/base.css.js' | ||
| import { imageAnimationStyles } from './styles/animation.css.js' | ||
| import { useImage } from './useImage.js' | ||
|
|
||
| export const Image = (props: ImageProps) => { | ||
| const { | ||
| shape, | ||
| colors, | ||
| state, | ||
| busy, | ||
| hasSource, | ||
| fallbackContent, | ||
| errorDescription, | ||
| loadingIndicator, | ||
| containerProps, | ||
| imageProps, | ||
| } = useImage(props) | ||
| return ( | ||
| <div | ||
| {...containerProps} | ||
| className={clsx(containerStyles, containerProps.className)} | ||
| style={{ | ||
| width: imageProps.width ?? shape.container.width, | ||
| height: imageProps.height ?? shape.container.height, | ||
| borderRadius: shape.container.radius, | ||
| ...containerProps.style, | ||
| }} | ||
| > | ||
| <div | ||
| aria-hidden='true' | ||
| className={clsx(fallbackStyles, imageAnimationStyles)} | ||
| style={{ | ||
| backgroundColor: colors.fallback.backgroundColor, | ||
| paddingInline: shape.fallback.paddingInline, | ||
| gap: shape.fallback.gap, | ||
| color: state === 'error' ? colors.fallback.errorColor : colors.fallback.color, | ||
| }} | ||
| > | ||
| {state !== 'loaded' && | ||
| (fallbackContent === undefined ? ( | ||
| <> | ||
| <PlaceholderIcon className={fallbackIconStyles} height='auto' /> | ||
| {state === 'error' && errorDescription && ( | ||
| <span className={descriptionStyles} style={shape.fallback.typography}> | ||
| {errorDescription} | ||
| </span> | ||
| )} | ||
| </> | ||
| ) : ( | ||
| fallbackContent | ||
| ))} | ||
| </div> | ||
| {hasSource && ( | ||
| <img | ||
| {...imageProps} | ||
| alt={imageProps.alt} | ||
| data-loaded={state === 'loaded'} | ||
| className={clsx(pictureStyles, imageAnimationStyles, imageProps.className)} | ||
| style={{ ...shape.picture, ...imageProps.style }} | ||
| /> | ||
| )} | ||
| <div | ||
| className={clsx(loadingStyles, imageAnimationStyles)} | ||
| data-loading={busy} | ||
| aria-hidden='true' | ||
| style={{ backgroundColor: colors.loading.backgroundColor }} | ||
| > | ||
| {busy && | ||
| (loadingIndicator === undefined ? ( | ||
| <CircleProgress shape={shape.loading.progress} appearance={colors.loading.progress} /> | ||
| ) : ( | ||
| loadingIndicator | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
This file contains hidden or 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,7 @@ | ||
| import { style } from '@vanilla-extract/css' | ||
| export const containerStyles = style({ | ||
| position: 'relative', | ||
| display: 'inline-block', | ||
| overflow: 'hidden', | ||
| verticalAlign: 'middle', | ||
| }) |
This file contains hidden or 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 @@ | ||
| export const IMAGE_SIZE = 120 |
This file contains hidden or 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,6 @@ | ||
| import type { CSSProperties } from 'react' | ||
| export interface ContainerShape { | ||
| width: CSSProperties['width'] | ||
| height: CSSProperties['height'] | ||
| radius: CSSProperties['borderRadius'] | ||
| } |
This file contains hidden or 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,8 @@ | ||
| import type { ContainerShape } from './interfaces.js' | ||
|
|
||
| import { radii } from '@atls-ui/theme/tokens' | ||
|
|
||
| import { IMAGE_SIZE } from './constants.js' | ||
| export const containerShapes = { | ||
| default: { width: IMAGE_SIZE, height: IMAGE_SIZE, radius: radii.none }, | ||
| } satisfies Record<string, ContainerShape> |
This file contains hidden or 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,5 @@ | ||
| export interface FallbackAppearance { | ||
| backgroundColor: string | ||
| color: string | ||
| errorColor: string | ||
| } |
This file contains hidden or 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 @@ | ||
| import type { Theme } from '@atls-ui/theme' | ||
|
|
||
| import type { FallbackAppearance } from './interfaces.js' | ||
| export const fallbackAppearances = { | ||
| default: (theme: Theme): FallbackAppearance => ({ | ||
| backgroundColor: theme.colors.action.subtle, | ||
| color: theme.colors.text.primary, | ||
| errorColor: theme.colors.status.error, | ||
| }), | ||
| } |
This file contains hidden or 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,26 @@ | ||
| import { style } from '@vanilla-extract/css' | ||
|
|
||
| import { spacing } from '@atls-ui/theme/tokens' | ||
| export const fallbackStyles = style({ | ||
| position: 'absolute', | ||
| inset: 0, | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| boxSizing: 'border-box', | ||
| textAlign: 'center', | ||
| }) | ||
| export const fallbackIconStyles = style({ | ||
| display: 'block', | ||
| flexShrink: 0, | ||
| width: '100%', | ||
| height: 'auto', | ||
| }) | ||
| export const descriptionStyles = style({ | ||
| flexShrink: 0, | ||
| width: '100%', | ||
| margin: spacing.component.none, | ||
| overflowWrap: 'anywhere', | ||
| maxWidth: '100%', | ||
| }) |
This file contains hidden or 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,6 @@ | ||
| import type { CSSProperties } from 'react' | ||
| export interface FallbackShape { | ||
| paddingInline: CSSProperties['paddingInline'] | ||
| gap: CSSProperties['gap'] | ||
| typography: CSSProperties | ||
| } |
This file contains hidden or 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,12 @@ | ||
| import type { FallbackShape } from './interfaces.js' | ||
|
|
||
| import { spacing } from '@atls-ui/theme/tokens' | ||
| import { typography } from '@atls-ui/theme/tokens' | ||
|
|
||
| export const fallbackShapes = { | ||
| default: { | ||
| paddingInline: spacing.component.lg, | ||
| gap: spacing.component.xs, | ||
| typography: typography.overline, | ||
| }, | ||
| } satisfies Record<string, FallbackShape> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 +1,12 @@ | ||
| export * from './image.component.js' | ||
| export { Image } from './component.js' | ||
| export type { ImageProps } from './interfaces.js' | ||
| export type { ImageShape } from './styles/shape/interfaces.js' | ||
| export { imageShapes } from './styles/shape/variants.js' | ||
| export type { ImageAppearance } from './styles/appearance/interfaces.js' | ||
| export { imageAppearances } from './styles/appearance/variants.js' | ||
| export type { ContainerShape } from './container/styles/shape/interfaces.js' | ||
| export type { PictureShape } from './picture/styles/shape/interfaces.js' | ||
| export type { FallbackShape } from './fallback/styles/shape/interfaces.js' | ||
| export type { FallbackAppearance } from './fallback/styles/appearance/interfaces.js' | ||
| export type { LoadingShape } from './loading/styles/shape/interfaces.js' | ||
| export type { LoadingAppearance } from './loading/styles/appearance/interfaces.js' |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.