-
-
Save mattduffield/a12b0fdfcb7b12169fdd3b833e1f0c74 to your computer and use it in GitHub Desktop.
Flexbox Sample
This file contains 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="styles.css"></require> | |
<require from="flexbox"></require> | |
<flexbox flex-class="full-height" flex-direction="column"> | |
<flexbox flex="none">header</flexbox> | |
<flexbox flex="1">main content...</flexbox> | |
</flexbox> | |
</template> |
This file contains 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
export class App { | |
message = 'Hello World!'; | |
} |
This file contains 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> | |
<div class="flex ${flexClass}" | |
css="flex-direction: ${flexDirection}; flex-wrap: ${flexWrap}; justify-content: ${justifyContent}; align-items: ${alignItems}; align-content: ${alignContent}; order: ${order}; flex: ${flex}; background: ${background}; color: ${color}; width: ${width};"> | |
<slot></slot> | |
</div> | |
</template> |
This file contains 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 {customElement, bindable} from 'aurelia-framework'; | |
@customElement('flexbox') | |
@bindable({ | |
name:'flexClass', | |
defaultValue: '' | |
}) | |
@bindable({ | |
name:'display', | |
defaultValue: 'flex' | |
}) | |
@bindable({ | |
name: 'flexDirection', | |
defaultValue: 'row' | |
}) | |
@bindable({ | |
name: 'flexWrap', | |
defaultValue: 'nowrap' | |
}) | |
@bindable({ | |
name:'justifyContent', | |
defaultValue: 'flex-start' | |
}) | |
@bindable({ | |
name:'alignItems', | |
defaultValue: 'stretch' | |
}) | |
@bindable({ | |
name:'alignContent', | |
defaultValue: 'stretch' | |
}) | |
@bindable({ | |
name:'order', | |
defaultValue: '' | |
}) | |
@bindable({ | |
name:'flex', | |
defaultValue: '0 1 auto' | |
}) | |
@bindable({ | |
name:'height', | |
defaultValue: '' | |
}) | |
@bindable({ | |
name:'width', | |
defaultValue: '' | |
}) | |
@bindable({ | |
name:'background', | |
defaultValue: '' | |
}) | |
@bindable({ | |
name:'color', | |
defaultValue: 'black' | |
}) | |
export class Flexbox { | |
} |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
<script> | |
require(['aurelia-bootstrapper']); | |
</script> | |
</body> | |
</html> |
This file contains 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, body { height: 100%; } | |
.full-height { height: 100%; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment