2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-skeleton {
|
|
|
|
overflow: hidden;
|
|
|
|
background-color: ${dt('skeleton.background')};
|
2024-05-06 21:18:22 +00:00
|
|
|
border-radius: ${dt('border.radius.md')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-skeleton::after {
|
|
|
|
content: "";
|
|
|
|
animation: p-skeleton-animation 1.2s infinite;
|
|
|
|
height: 100%;
|
|
|
|
left: 0;
|
|
|
|
position: absolute;
|
|
|
|
right: 0;
|
|
|
|
top: 0;
|
|
|
|
transform: translateX(-100%);
|
|
|
|
z-index: 1;
|
|
|
|
background: linear-gradient( 90deg, rgba(255, 255, 255, 0), ${dt('skeleton.animation.background')}, rgba(255, 255, 255, 0) );
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-skeleton-circle {
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-skeleton-animation-none::after {
|
|
|
|
animation: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes p-skeleton-animation {
|
|
|
|
from {
|
|
|
|
transform: translateX(-100%);
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
transform: translateX(100%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const inlineStyles = {
|
|
|
|
root: { position: 'relative' }
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => [
|
|
|
|
'p-skeleton p-component',
|
|
|
|
{
|
|
|
|
'p-skeleton-circle': props.shape === 'circle',
|
2024-04-08 11:18:20 +00:00
|
|
|
'p-skeleton-animation-none': props.animation === 'none'
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'skeleton',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|