Skip to content

Commit

Permalink
updated the Skeleton component
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeriaMaltseva committed Dec 16, 2024
1 parent 1af133b commit 90dcd81
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Pimcore
*
* This source file is available under two different licenses:
* - Pimcore Open Core License (POCL)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

import { type Meta } from '@storybook/react'
import { SkeletonAvatar } from './skeleton-avatar'

const config: Meta = {
title: 'Components/General/Skeleton/SkeletonAvatar',
component: SkeletonAvatar,
args: {
active: true
}
}

export const _default = {}

export const Large = {
args: {
size: 'large'
}
}

export const WithSquareShape = {
args: {
shape: 'square'
}
}

export default config
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import type { AvatarProps } from 'antd/es/skeleton/Avatar'

export interface ISkeletonAvatarProps extends SkeletonProps, AvatarProps {}

const SkeletonAvatar = (props: ISkeletonAvatarProps): JSX.Element => {
export const SkeletonAvatar = (props: ISkeletonAvatarProps): JSX.Element => {
return (
<AntSkeleton.Avatar { ...props } />
)
}

export default SkeletonAvatar
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Pimcore
*
* This source file is available under two different licenses:
* - Pimcore Open Core License (POCL)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

import { type Meta } from '@storybook/react'
import { SkeletonButton } from './skeleton-button'

const config: Meta = {
title: 'Components/General/Skeleton/SkeletonButton',
component: SkeletonButton,
args: {
active: true
}
}

export const _default = {}

export const Round = {
args: {
shape: 'round'
}
}

export const Small = {
args: {
size: 'small'
}
}

export default config
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import type { SkeletonButtonProps } from 'antd/es/skeleton/Button'

export interface ISkeletonButtonProps extends SkeletonProps, SkeletonButtonProps {}

const SkeletonButton = (props: ISkeletonButtonProps): JSX.Element => {
export const SkeletonButton = (props: ISkeletonButtonProps): JSX.Element => {
return (
<AntSkeleton.Button { ...props } />
)
}

export default SkeletonButton
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,29 @@
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

export { default } from './skeleton'
import { type Meta } from '@storybook/react'
import { SkeletonInput } from './skeleton-input'

export { default as SkeletonAvatar } from './components/skeleton-avatar'
export { default as SkeletonButton } from './components/skeleton-button'
export { default as SkeletonInput } from './components/skeleton-input'
const config: Meta = {
title: 'Components/General/Skeleton/SkeletonInput',
component: SkeletonInput,
args: {
active: true
}
}

export const _default = {}

export const Large = {
args: {
size: 'large'
}
}

export const Small = {
args: {
size: 'small'
}
}

export default config
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import type { SkeletonInputProps } from 'antd/es/skeleton/Input'

export interface ISkeletonInputProps extends SkeletonProps, SkeletonInputProps {}

const SkeletonInput = (props: ISkeletonInputProps): JSX.Element => {
export const SkeletonInput = (props: ISkeletonInputProps): JSX.Element => {
return (
<AntSkeleton.Input { ...props } />
)
}

export default SkeletonInput
30 changes: 6 additions & 24 deletions assets/js/src/core/components/skeleton/skeleton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,23 @@
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

import React from 'react'
import { type Meta } from '@storybook/react'
import Skeleton from './skeleton'
import SkeletonAvatar from './components/skeleton-avatar'
import SkeletonButton from './components/skeleton-button'
import SkeletonInput from './components/skeleton-input'
import { Skeleton } from './skeleton'

const config: Meta = {
title: 'Components/General/Skeleton',
component: Skeleton,
args: {
active: true
},
tags: ['autodocs'],
parameters: {
docs: {
source: {
type: 'code'
}
}
}
}

export const _default = {}

export const WithAvatar = (): JSX.Element => (
<SkeletonAvatar />
)

export const WithButton = (): JSX.Element => (
<SkeletonButton />
)

export const WithInput = (): JSX.Element => (
<SkeletonInput />
)
export const Rounded = {
args: {
round: true
}
}

export default config
4 changes: 1 addition & 3 deletions assets/js/src/core/components/skeleton/skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import { Skeleton as AntSkeleton, type SkeletonProps } from 'antd'

export interface ISkeletonProps extends SkeletonProps {}

const Skeleton = (props: ISkeletonProps): JSX.Element => {
export const Skeleton = (props: ISkeletonProps): JSX.Element => {
return (
<AntSkeleton { ...props } />
)
}

export default Skeleton
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
import React from 'react'
import { Skeleton } from 'antd'
import { useStyle } from './skeleton.styles'
import { SkeletonInput } from '@Pimcore/components/skeleton'

export const PaginationSkeleton = (): React.JSX.Element => {
const { styles } = useStyle()

return (
<div className={ styles.skeleton }>
<SkeletonInput
<Skeleton.Input
active
size={ 'small' }
/>
Expand Down

0 comments on commit 90dcd81

Please sign in to comment.