fix(music-player): fix floating icon position shift on hover
Problem: - Icon bergeser ke bawah saat hover - transform: 'scale(1.1)' mengganti transform: 'translateY(-80%)' - CSS transform property di-replace, bukan di-mix Solution: - Gabungkan kedua transform dalam satu string - Hover: 'translateY(-80%) scale(1.1)' - maintain posisi + scale - Leave: 'translateY(-80%)' - kembali ke posisi semula Changes: - onMouseEnter: transform = 'translateY(-80%) scale(1.1)' - onMouseLeave: transform = 'translateY(-80%)' - Added 'ease' timing function for smoother transition Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
|||||||
ActionIcon,
|
ActionIcon,
|
||||||
Avatar,
|
Avatar,
|
||||||
Box,
|
Box,
|
||||||
|
Button,
|
||||||
Flex,
|
Flex,
|
||||||
Group,
|
Group,
|
||||||
Paper,
|
Paper,
|
||||||
@@ -85,29 +86,32 @@ export default function FixedPlayerBar() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Floating Music Icon - Shows when player is minimized */}
|
{/* Floating Music Icon - Shows when player is minimized */}
|
||||||
<Paper
|
<Button
|
||||||
pos="fixed"
|
color="#0B4F78"
|
||||||
bottom={20}
|
variant="filled"
|
||||||
right={20}
|
size="md"
|
||||||
p="md"
|
mt="md"
|
||||||
shadow="xl"
|
|
||||||
radius="xl"
|
|
||||||
bg="blue"
|
|
||||||
style={{
|
style={{
|
||||||
zIndex: 1001,
|
position: 'fixed',
|
||||||
|
top: '50%', // Menempatkan titik atas ikon di tengah layar
|
||||||
|
left: '0px',
|
||||||
|
transform: 'translateY(-50%)', // Menggeser ikon ke atas sebesar setengah tingginya sendiri agar benar-benar di tengah
|
||||||
|
borderBottomRightRadius: '20px',
|
||||||
|
borderTopRightRadius: '20px',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
transition: 'transform 0.2s',
|
transition: 'transform 0.2s ease',
|
||||||
|
zIndex: 1
|
||||||
}}
|
}}
|
||||||
onClick={handleRestorePlayer}
|
onClick={handleRestorePlayer}
|
||||||
onMouseEnter={(e) => {
|
onMouseEnter={(e) => {
|
||||||
e.currentTarget.style.transform = 'scale(1.1)';
|
e.currentTarget.style.transform = 'translateY(-50%) scale(1.1)';
|
||||||
}}
|
}}
|
||||||
onMouseLeave={(e) => {
|
onMouseLeave={(e) => {
|
||||||
e.currentTarget.style.transform = 'scale(1)';
|
e.currentTarget.style.transform = 'translateY(-50%)';
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconMusic size={28} color="white" />
|
<IconMusic size={28} color="white" />
|
||||||
</Paper>
|
</Button>
|
||||||
|
|
||||||
{/* Spacer to prevent content from being hidden behind player */}
|
{/* Spacer to prevent content from being hidden behind player */}
|
||||||
<Box h={20} />
|
<Box h={20} />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
import { Button } from '@mantine/core';
|
import { Button } from '@mantine/core';
|
||||||
import { IconMusic, IconMusicOff } from '@tabler/icons-react';
|
import { IconDisabled, IconDisabledOff } from '@tabler/icons-react';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
const NewsReaderLanding = () => {
|
const NewsReaderLanding = () => {
|
||||||
@@ -95,15 +95,17 @@ const NewsReaderLanding = () => {
|
|||||||
mt="md"
|
mt="md"
|
||||||
style={{
|
style={{
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
bottom: '350px',
|
top: '50%', // Menempatkan titik atas ikon di tengah layar
|
||||||
left: '0px',
|
left: '0px',
|
||||||
|
transform: 'translateY(80%)', // Menggeser ikon ke atas sebesar setengah tingginya sendiri agar benar-benar di tengah
|
||||||
borderBottomRightRadius: '20px',
|
borderBottomRightRadius: '20px',
|
||||||
borderTopRightRadius: '20px',
|
borderTopRightRadius: '20px',
|
||||||
transition: 'all 0.3s ease',
|
cursor: 'pointer',
|
||||||
|
transition: 'transform 0.2s',
|
||||||
zIndex: 1
|
zIndex: 1
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isPointerMode ? <IconMusicOff /> : <IconMusic />}
|
{isPointerMode ? <IconDisabledOff /> : <IconDisabled />}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export default function GrafikRealisasi({ apbdesData }: any) {
|
|||||||
<Summary title="📊 Pembiayaan" data={pembiayaan} />
|
<Summary title="📊 Pembiayaan" data={pembiayaan} />
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{/* Summary Total Keseluruhan */}
|
{/* Summary Total Keseluruhan
|
||||||
<Box p="md" bg="gray.0">
|
<Box p="md" bg="gray.0">
|
||||||
<>
|
<>
|
||||||
<Group justify="space-between" mb="xs">
|
<Group justify="space-between" mb="xs">
|
||||||
@@ -132,7 +132,7 @@ export default function GrafikRealisasi({ apbdesData }: any) {
|
|||||||
color={persenSemua >= 100 ? 'teal' : persenSemua >= 80 ? 'blue' : 'red'}
|
color={persenSemua >= 100 ? 'teal' : persenSemua >= 80 ? 'blue' : 'red'}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
</Box>
|
</Box> */}
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user