kopia lustrzana https://github.com/shoelace-style/shoelace
78 wiersze
1.7 KiB
TypeScript
78 wiersze
1.7 KiB
TypeScript
import { css } from 'lit';
|
|
import componentStyles from '../../styles/component.styles';
|
|
|
|
export default css`
|
|
${componentStyles}
|
|
|
|
:host {
|
|
--divider-width: 2px;
|
|
--handle-size: 2.5rem;
|
|
|
|
display: inline-block;
|
|
position: relative;
|
|
}
|
|
|
|
.image-comparer {
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.image-comparer__before,
|
|
.image-comparer__after {
|
|
display: block;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.image-comparer__before::slotted(img),
|
|
.image-comparer__after::slotted(img),
|
|
.image-comparer__before::slotted(svg),
|
|
.image-comparer__after::slotted(svg) {
|
|
display: block;
|
|
max-width: 100% !important;
|
|
height: auto;
|
|
}
|
|
|
|
.image-comparer__after {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
|
|
.image-comparer__divider {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: absolute;
|
|
top: 0;
|
|
width: var(--divider-width);
|
|
height: 100%;
|
|
background-color: var(--sl-color-neutral-0);
|
|
translate: calc(var(--divider-width) / -2);
|
|
cursor: ew-resize;
|
|
}
|
|
|
|
.image-comparer__handle {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: absolute;
|
|
top: calc(50% - (var(--handle-size) / 2));
|
|
width: var(--handle-size);
|
|
height: var(--handle-size);
|
|
background-color: var(--sl-color-neutral-0);
|
|
border-radius: var(--sl-border-radius-circle);
|
|
font-size: calc(var(--handle-size) * 0.5);
|
|
color: var(--sl-color-neutral-700);
|
|
cursor: inherit;
|
|
z-index: 10;
|
|
}
|
|
|
|
.image-comparer__handle:focus-visible {
|
|
outline: var(--sl-focus-ring);
|
|
outline-offset: var(--sl-focus-ring-offset);
|
|
}
|
|
`;
|