70 lines
1.4 KiB
JavaScript
70 lines
1.4 KiB
JavaScript
import BaseStyle from 'primevue/base/style';
|
|
|
|
const theme = ({ dt }) => `
|
|
.p-scrolltop {
|
|
position: fixed;
|
|
bottom: 20px;
|
|
right: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: ${dt('scrolltop.background')};
|
|
color: ${dt('scrolltop.color')};
|
|
}
|
|
|
|
.p-scrolltop:hover {
|
|
background: ${dt('scrolltop.hover.background')};
|
|
color: ${dt('scrolltop.hover.text')};
|
|
}
|
|
|
|
.p-scrolltop-icon {
|
|
font-size: 1.5rem;
|
|
width: 1.5rem;
|
|
height: 1.5rem;
|
|
}
|
|
|
|
.p-scrolltop-sticky {
|
|
position: sticky;
|
|
}
|
|
|
|
.p-scrolltop-sticky {
|
|
margin-left: auto;
|
|
}
|
|
|
|
.p-scrolltop-enter-from {
|
|
opacity: 0;
|
|
}
|
|
|
|
.p-scrolltop-enter-active {
|
|
transition: opacity 0.15s;
|
|
}
|
|
|
|
.p-scrolltop.p-scrolltop-leave-to {
|
|
opacity: 0;
|
|
}
|
|
|
|
.p-scrolltop-leave-active {
|
|
transition: opacity 0.15s;
|
|
}
|
|
|
|
.p-scrolltop {
|
|
width: 3rem;
|
|
height: 3rem;
|
|
border-radius: 50%;
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
|
|
outline-color: transparent;
|
|
}
|
|
`;
|
|
|
|
const classes = {
|
|
root: ({ props }) => ['p-scrolltop p-link p-component', { 'p-scrolltop-sticky': props.target !== 'window' }],
|
|
icon: 'p-scrolltop-icon'
|
|
};
|
|
|
|
export default BaseStyle.extend({
|
|
name: 'scrolltop',
|
|
theme,
|
|
classes
|
|
});
|