mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
added basic root scale effect
This commit is contained in:
parent
c195f92912
commit
a4f5112c3a
@ -90,6 +90,9 @@ export default class Layout extends React.PureComponent {
|
|||||||
toggleCenteredContent: (to) => {
|
toggleCenteredContent: (to) => {
|
||||||
return this.layoutInterface.toggleRootContainerClassname("centered-content", to)
|
return this.layoutInterface.toggleRootContainerClassname("centered-content", to)
|
||||||
},
|
},
|
||||||
|
toggleRootScaleEffect: (to) => {
|
||||||
|
return this.layoutInterface.toggleRootContainerClassname("root-scale-effect", to)
|
||||||
|
},
|
||||||
toggleMobileStyle: (to) => {
|
toggleMobileStyle: (to) => {
|
||||||
return this.layoutInterface.toggleRootContainerClassname("mobile", to)
|
return this.layoutInterface.toggleRootContainerClassname("mobile", to)
|
||||||
},
|
},
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Drawer } from "vaul"
|
import { Drawer } from "vaul"
|
||||||
|
|
||||||
import {createIconRender} from "@components/Icons"
|
import ActionsMenu from "../@mobile/actionsMenu"
|
||||||
import { Translation } from "react-i18next"
|
|
||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ export class DraggableDrawerController extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions = (data) => {
|
actions = (data) => {
|
||||||
const win = this.open("actions-menu", ActionsComponent, {
|
const win = this.open("actions-menu", ActionsMenu, {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
...data,
|
...data,
|
||||||
}
|
}
|
||||||
@ -57,6 +56,7 @@ export class DraggableDrawerController extends React.Component {
|
|||||||
const win = app.cores.window_mng.render(
|
const win = app.cores.window_mng.render(
|
||||||
id,
|
id,
|
||||||
<DraggableDrawer
|
<DraggableDrawer
|
||||||
|
options={options}
|
||||||
onClosed={() => this.handleDrawerOnClosed(drawerObj)}
|
onClosed={() => this.handleDrawerOnClosed(drawerObj)}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
@ -103,6 +103,14 @@ export class DraggableDrawerController extends React.Component {
|
|||||||
app.cores.window_mng.close(drawer.winId)
|
app.cores.window_mng.close(drawer.winId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
if (this.state.drawers.length === 0) {
|
||||||
|
app.layout.toggleRootScaleEffect(false)
|
||||||
|
} else {
|
||||||
|
app.layout.toggleRootScaleEffect(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -145,6 +153,13 @@ export const DraggableDrawer = (props) => {
|
|||||||
<Drawer.Handle
|
<Drawer.Handle
|
||||||
className="app-drawer-handle"
|
className="app-drawer-handle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Drawer.Title
|
||||||
|
className="app-drawer-title"
|
||||||
|
>
|
||||||
|
{props.options?.title ?? "Drawer Title"}
|
||||||
|
</Drawer.Title>
|
||||||
|
|
||||||
{
|
{
|
||||||
React.cloneElement(props.children, {
|
React.cloneElement(props.children, {
|
||||||
close: () => setIsOpen(false),
|
close: () => setIsOpen(false),
|
||||||
@ -153,26 +168,4 @@ export const DraggableDrawer = (props) => {
|
|||||||
</Drawer.Content>
|
</Drawer.Content>
|
||||||
</Drawer.Portal>
|
</Drawer.Portal>
|
||||||
</Drawer.Root>
|
</Drawer.Root>
|
||||||
}
|
|
||||||
|
|
||||||
const ActionsComponent = (props) => {
|
|
||||||
console.log(props)
|
|
||||||
return <div
|
|
||||||
className="app-drawer-actions"
|
|
||||||
>
|
|
||||||
{
|
|
||||||
props.list.map((action) => {
|
|
||||||
return <div
|
|
||||||
key={action.id}
|
|
||||||
className="app-drawer-action"
|
|
||||||
onClick={() => {
|
|
||||||
action.onClick()
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{createIconRender(action.icon)}
|
|
||||||
<span><Translation>{t => t(action.label)}</Translation></span>
|
|
||||||
</div>
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
}
|
@ -38,30 +38,12 @@
|
|||||||
border-radius: 24px 24px 0 0;
|
border-radius: 24px 24px 0 0;
|
||||||
|
|
||||||
background-color: var(--background-color-accent);
|
background-color: var(--background-color-accent);
|
||||||
|
|
||||||
|
.app-drawer-title {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-drawer-handle {
|
.app-drawer-handle {
|
||||||
background-color: var(--background-color-contrast);
|
background-color: var(--background-color-contrast);
|
||||||
}
|
|
||||||
|
|
||||||
.app-drawer-actions {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
gap: 10px;
|
|
||||||
|
|
||||||
color: var(--text-color);
|
|
||||||
|
|
||||||
.app-drawer-action {
|
|
||||||
display: inline-flex;
|
|
||||||
flex-direction: row;
|
|
||||||
|
|
||||||
padding: 10px;
|
|
||||||
|
|
||||||
border-radius: 12px;
|
|
||||||
|
|
||||||
font-size: 1rem;
|
|
||||||
|
|
||||||
background-color: var(--background-color-primary);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -70,6 +70,8 @@ a {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
|
transition: all 150ms ease-in-out;
|
||||||
|
|
||||||
&.electron {
|
&.electron {
|
||||||
.ant-layout-sider {
|
.ant-layout-sider {
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
@ -145,6 +147,15 @@ html {
|
|||||||
|
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|
||||||
|
&.root-scale-effect {
|
||||||
|
background-color: black !important;
|
||||||
|
|
||||||
|
#root {
|
||||||
|
animation: rootScaleOut 250ms ease-in-out forwards;
|
||||||
|
animation-delay: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.centered-content {
|
&.centered-content {
|
||||||
.content_layout {
|
.content_layout {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@ -191,7 +202,6 @@ span {
|
|||||||
|
|
||||||
svg {
|
svg {
|
||||||
color: currentColor;
|
color: currentColor;
|
||||||
margin-right: 10px;
|
|
||||||
vertical-align: -0.125em;
|
vertical-align: -0.125em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,4 +366,17 @@ svg {
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
|
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rootScaleOut {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
border-radius: 24px;
|
||||||
|
transform: perspective(1000px) scale(0.99);
|
||||||
|
box-shadow: 0 0 500px 10px var(--colorPrimary);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user