feat: refine widget interactions
This commit is contained in:
1 parent
a8a7545f40
commit
842e86012d
107 files changed
+3144
-1233
No files matched your search
@@ -24,29 +24,42 @@
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.dots {
|
||||
.carouselControls {
|
||||
position: absolute;
|
||||
bottom: 12px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 10;
|
||||
inset-block-start: 8px;
|
||||
inset-inline-end: 8px;
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translateY(-2px);
|
||||
transition:
|
||||
opacity 120ms ease,
|
||||
transform 120ms ease;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
.carouselContainer:hover .carouselControls,
|
||||
.carouselContainer:focus-within .carouselControls,
|
||||
.carouselControls[data-visible="true"] {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
&[data-active="true"] {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
width: 24px;
|
||||
border-radius: 4px;
|
||||
@media (any-pointer: coarse) {
|
||||
.carouselControls {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
.carouselControls button {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.carouselControls {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -161,41 +161,48 @@ function Carousel({
|
||||
<Box w="100%" style={{ flex: 1, minHeight: 0 }} className={classes.carouselContainer}>
|
||||
<Image src={currentAsset.publicLink} alt={t("albumPhoto")} className={classes.carouselImage} />
|
||||
|
||||
{advanced && (
|
||||
<>
|
||||
<ActionIcon
|
||||
aria-label={t("actions.previousPhoto")}
|
||||
variant="filled"
|
||||
radius="xl"
|
||||
pos="absolute"
|
||||
left="md"
|
||||
top="50%"
|
||||
onClick={() => move(-1)}
|
||||
>
|
||||
<IconChevronLeft size={18} />
|
||||
</ActionIcon>
|
||||
<Group pos="absolute" right="md" top="md" gap="xs">
|
||||
{assets.length > 1 && (
|
||||
<Group
|
||||
className={classes.carouselControls}
|
||||
data-visible={advanced || paused || undefined}
|
||||
gap={4}
|
||||
wrap="nowrap"
|
||||
>
|
||||
{advanced && (
|
||||
<ActionIcon
|
||||
aria-label={paused ? t("actions.resumeSlideshow") : t("actions.pauseSlideshow")}
|
||||
aria-label={t("actions.previousPhoto")}
|
||||
variant="filled"
|
||||
color="dark"
|
||||
radius="xl"
|
||||
onClick={() => setPaused((value) => !value)}
|
||||
size={40}
|
||||
onClick={() => move(-1)}
|
||||
>
|
||||
{paused ? <IconPlayerPlay size={16} /> : <IconPlayerPause size={16} />}
|
||||
<IconChevronLeft size={18} />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
)}
|
||||
<ActionIcon
|
||||
aria-label={t("actions.nextPhoto")}
|
||||
aria-label={paused ? t("actions.resumeSlideshow") : t("actions.pauseSlideshow")}
|
||||
variant="filled"
|
||||
color="dark"
|
||||
radius="xl"
|
||||
pos="absolute"
|
||||
right="md"
|
||||
top="50%"
|
||||
onClick={() => move(1)}
|
||||
size={advanced ? 40 : 32}
|
||||
onClick={() => setPaused((value) => !value)}
|
||||
>
|
||||
<IconChevronRight size={18} />
|
||||
{paused ? <IconPlayerPlay size={18} /> : <IconPlayerPause size={18} />}
|
||||
</ActionIcon>
|
||||
</>
|
||||
{advanced && (
|
||||
<ActionIcon
|
||||
aria-label={t("actions.nextPhoto")}
|
||||
variant="filled"
|
||||
color="dark"
|
||||
radius="xl"
|
||||
size={40}
|
||||
onClick={() => move(1)}
|
||||
>
|
||||
<IconChevronRight size={18} />
|
||||
</ActionIcon>
|
||||
)}
|
||||
</Group>
|
||||
)}
|
||||
|
||||
{(showPhotoInfo || advanced) && (
|
||||
|
||||
Reference in new issue
Block a user