diff --git a/packages/svelte-materialify/src/components/Window/Window.scss b/packages/svelte-materialify/src/components/Window/Window.scss new file mode 100644 index 00000000..08cf9ffe --- /dev/null +++ b/packages/svelte-materialify/src/components/Window/Window.scss @@ -0,0 +1,66 @@ +@import './variables'; + +.s-window { + position: relative; + width: 100%; + overflow: hidden; + transition: 0.3s $window-transition-function; + + &.horizontal { + .s-window-item { + &.next:not(.left), + &.active.right { + transform: translateX(100%); + } + + &.prev:not(.right), + &.active.left { + transform: translateX(-100%); + } + } + } + + &.vertical { + .s-window-item { + &.next:not(.left), + &.active.right { + transform: translateY(100%); + } + + &.prev:not(.right), + &.active.left { + transform: translateY(-100%); + } + } + } + + &.reverse { + &.horizontal { + .s-window-item { + &.next:not(.left), + &.active.right { + transform: translateX(-100%); + } + + &.prev:not(.right), + &.active.left { + transform: translateX(100%); + } + } + } + + &.vertical { + .s-window-item { + &.next:not(.left), + &.active.right { + transform: translateY(-100%); + } + + &.prev:not(.right), + &.active.left { + transform: translateY(100%); + } + } + } + } +} diff --git a/packages/svelte-materialify/src/components/Window/Window.svelte b/packages/svelte-materialify/src/components/Window/Window.svelte new file mode 100644 index 00000000..f5816976 --- /dev/null +++ b/packages/svelte-materialify/src/components/Window/Window.svelte @@ -0,0 +1,92 @@ + + + + +
+ +
diff --git a/packages/svelte-materialify/src/components/Window/WindowItem.scss b/packages/svelte-materialify/src/components/Window/WindowItem.scss new file mode 100644 index 00000000..e30ac59f --- /dev/null +++ b/packages/svelte-materialify/src/components/Window/WindowItem.scss @@ -0,0 +1,18 @@ +@import './variables'; + +.s-window-item { + position: relative; + display: none; + align-items: center; + width: 100%; + float: left; + margin-right: -100%; + backface-visibility: hidden; + transition: 0.3s $window-transition-function; + + &.active, + &.next, + &.prev { + display: block; + } +} diff --git a/packages/svelte-materialify/src/components/Window/WindowItem.svelte b/packages/svelte-materialify/src/components/Window/WindowItem.svelte new file mode 100644 index 00000000..9200f90b --- /dev/null +++ b/packages/svelte-materialify/src/components/Window/WindowItem.svelte @@ -0,0 +1,12 @@ + + + + +
+ +
diff --git a/packages/svelte-materialify/src/components/Window/_variables.scss b/packages/svelte-materialify/src/components/Window/_variables.scss new file mode 100644 index 00000000..6c8bc8c9 --- /dev/null +++ b/packages/svelte-materialify/src/components/Window/_variables.scss @@ -0,0 +1,3 @@ +@import '../../styles/variables'; + +$window-transition-function: cubic-bezier(0.25, 0.8, 0.5, 1) !default; diff --git a/packages/svelte-materialify/src/components/Window/index.js b/packages/svelte-materialify/src/components/Window/index.js new file mode 100644 index 00000000..22c29a1d --- /dev/null +++ b/packages/svelte-materialify/src/components/Window/index.js @@ -0,0 +1,2 @@ +export { default } from './Window.svelte'; +export { default as WindowItem } from './WindowItem.svelte';