This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useShadowDOM} from 'aurelia-framework'; //import the useShadowDOM decorator | |
@useShadowDOM() //decorator provided by the Aurelia framework to use the Shadow DOM | |
export class InfoCard{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<style> | |
.card-content { | |
border:1px solid grey; | |
width: 500px; | |
height: 150px; | |
margin-bottom:10px; | |
padding:20px; | |
color: #777; | |
background-color: #F7F7F7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./card-styles.css" as="scoped"></require> //only works in Firefox at the time of writing | |
<template id="info-card"> | |
<div class="card-content"> | |
<slot name="header">To be replaced with header</slot> | |
<div class="card-body"> | |
<slot name="body"><p>To be replaced with body </p></slot> | |
</div> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template id="info-card"> | |
<slot name="header"><h1>To be replaced with header</h1></slot> | |
<slot name="body"><p>To be replaced with body </p></slot> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template id="info-card"> | |
</template> | |
<script> | |
class XInfoCard extends HTMLElement { | |
// Monitor the 'message' attribute for changes. | |
static get observedAttributes() { return ['message']; } | |
// Respond to attribute changes. | |
attributeChangedCallback(attr, oldValue, newValue) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head></head> | |
<body> | |
<p id="component-host"></p> | |
<script> | |
var shadowElement = document.querySelector('#component-host') | |
.attachShadow({mode: 'open'}); | |
shadow.innerHTML = '<span>DOM subtree</span>'; | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
</head> | |
<body> | |
<template id="info-card"> | |
<style> | |
.card-content { | |
border:1px solid grey; | |
width: 500px; | |
height: 150px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
</head> | |
<body> | |
<template id="info-card"> | |
<style> | |
.card-content { | |
border:1px solid grey; | |
width: 500px; | |
height: 150px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<x-info-card message="basic info card content"></x-info-card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {bindable} from 'aurelia-framework'; //import bindable decorator to allow message to be passed down from parent component | |
export class InfoCard{ | |
@bindable message; | |
} |