mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
tweak(phone): Split Phone component into wrapper
This commit is contained in:
1 parent
4b7a6280fd
commit
3e01fc456c
2 files changed
+81
-65
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import React from 'react';
|
||||
import { isDefaultWallpaper } from './apps/settings/utils/isDefaultWallpaper';
|
||||
import { useSettings } from './apps/settings/hooks/useSettings';
|
||||
import { usePhoneVisibility } from './os/phone/hooks/usePhoneVisibility';
|
||||
import { Slide } from '@material-ui/core';
|
||||
|
||||
const PhoneWrapper: React.FC = ({ children }) => {
|
||||
const [settings] = useSettings();
|
||||
const { bottom, visibility } = usePhoneVisibility();
|
||||
|
||||
return (
|
||||
<Slide direction="up" timeout={{ enter: 500, exit: 500 }} in={visibility}>
|
||||
<div className="PhoneWrapper">
|
||||
<div
|
||||
className="Phone"
|
||||
style={{
|
||||
position: 'fixed',
|
||||
transformOrigin: 'right bottom',
|
||||
transform: `scale(${settings.zoom.value}`,
|
||||
bottom,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="PhoneFrame"
|
||||
style={{
|
||||
backgroundImage: `url(media/frames/${settings.frame.value})`,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
id="phone"
|
||||
className="PhoneScreen"
|
||||
style={{
|
||||
backgroundImage: !isDefaultWallpaper(settings.wallpaper.value)
|
||||
? `url(${settings.wallpaper.value})`
|
||||
: `url(media/backgrounds/${settings.wallpaper.value})`,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Slide>
|
||||
);
|
||||
};
|
||||
|
||||
export default PhoneWrapper;
|
||||
Reference in new issue
Block a user