Skip to content

Commit

Permalink
Add Masks
Browse files Browse the repository at this point in the history
  • Loading branch information
SauravKanchan committed May 22, 2020
1 parent eb4b24c commit 6d6404d
Show file tree
Hide file tree
Showing 8 changed files with 531 additions and 4 deletions.
21 changes: 21 additions & 0 deletions src/MDBMask.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
import {clean, clsx, forwardEventsBuilder, getColorClass} from './utils';
import {current_component} from 'svelte/internal';
const forwardEvents = forwardEventsBuilder(current_component);
let className = '';
export {className as class};
let elementClasses;
export let pattern;
export let overlay;
const props = clean($$props, ["color", "overlay", "pattern"]);
$: elementClasses = clsx(className, 'mask', pattern && `pattern-${pattern}`, overlay && `rgba-${overlay}`)
</script>

<div use:forwardEvents {...props} class={elementClasses}>
<slot/>
</div>
44 changes: 44 additions & 0 deletions src/MDBView.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script>
import {clean, clsx, forwardEventsBuilder, getColorClass} from './utils';
import {current_component} from 'svelte/internal';
const forwardEvents = forwardEventsBuilder(current_component);
let className = '';
export {className as class};
let elementClasses;
export let zoom;
export let cascade;
export let hover;
export let rounded;
export let src;
export let waves;
export let fixed;
const props = clean($$props, ["zoom", cascade, "hover", "rounded", "waves", "src", "fixed"]);
elementClasses = clsx(
'view',
cascade && 'view-cascade',
className,
hover && 'overlay',
rounded && 'rounded',
waves ? 'Ripple-parent' : false,
zoom && 'zoom'
);
let elementStyle = src
? {
backgroundAttachment: fixed ? 'fixed' : null,
backgroundImage: `url("${src}")`,
backgroundPosition: 'center center',
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
height: '100vh'
}
: {}
</script>

<div use:forwardEvents {...props} class={elementClasses} style="{elementStyle}">
<slot/>
</div>
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ import MDBModalFooter from './MDBModalFooter.svelte'
import MDBModalHeader from './MDBModalHeader.svelte'
import MDBBreadcrumb from './MDBBreadcrumb.svelte'
import MDBBreadcrumbItem from './MDBBreadcrumbItem.svelte'
import MDBMask from './MDBMask.svelte'
import MDBView from './MDBView.svelte'

waves.init();

Expand Down Expand Up @@ -116,5 +118,7 @@ export {
MDBModalFooter,
MDBModalHeader,
MDBBreadcrumb,
MDBBreadcrumbItem
MDBBreadcrumbItem,
MDBMask,
MDBView
}
Loading

0 comments on commit 6d6404d

Please sign in to comment.