Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(image-list): Add base styles and mixins for Standard Image List #2367

Merged
merged 18 commits into from
Mar 10, 2018
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
326 changes: 326 additions & 0 deletions demos/image-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,326 @@
<!DOCTYPE html>
<!--
Copyright 2018 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License
-->
<html>
<head>
<meta charset="utf-8">
<title>Image List - Material Components Catalog</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/images/logo_components_color_2x_web_48dp.png">
<link rel="stylesheet" href="/assets/image-list.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="/ready.js"></script>
</head>
<body class="mdc-typography">
<header class="mdc-toolbar mdc-toolbar--fixed">
<div class="mdc-toolbar__row">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<a href="/" class="catalog-back mdc-toolbar__menu-icon"><i class="material-icons">&#xE5C4;</i></a>
<span class="mdc-toolbar__title catalog-title">Image List</span>
</section>
</div>
</header>
<main>
<div class="mdc-toolbar-fixed-adjust"></div>
<section class="hero">
<ul class="mdc-image-list hero-image-list">
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<div class="mdc-image-list__image"></div>
</div>
</li>
</ul>
</section>

<section class="example">
<div class="mdc-form-field">
<div class="mdc-checkbox">
<input type="checkbox" class="mdc-checkbox__native-control" id="toggle-rtl" aria-labelledby="toggle-rtl-label" />
<div class="mdc-checkbox__background">
<svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
<path class="mdc-checkbox__checkmark-path" fill="none" stroke="white" d="M1.73,12.91 8.1,19.28 22.79,4.59" />
</svg>
<div class="mdc-checkbox__mixedmark"></div>
</div>
</div>
<label for="toggle-rtl" id="toggle-rtl-label">Toggle RTL</label>
</div>

<h1 class="mdc-typography--headline">Standard Image List</h1>
<div>
<div class="mdc-form-field">
<div class="mdc-radio">
<input class="mdc-radio__native-control" type="radio" id="standard-label-below" name="standard-labels" checked>
<div class="mdc-radio__background">
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
</div>
<label for="standard-label-below">Labels below images</label>
</div>
<div class="mdc-form-field">
<div class="mdc-radio">
<input class="mdc-radio__native-control" type="radio" id="standard-label-protected" name="standard-labels">
<div class="mdc-radio__background">
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
</div>
<label for="standard-label-protected">Labels over images with text protection</label>
</div>
<div class="mdc-form-field">
<div class="mdc-radio">
<input class="mdc-radio__native-control" type="radio" id="standard-label-none" name="standard-labels">
<div class="mdc-radio__background">
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
</div>
<label for="standard-label-none">No labels</label>
</div>
</div>
<ul id="standard-image-list" class="mdc-image-list standard-image-list">
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
<li class="mdc-image-list__item">
<div class="mdc-image-list__image-aspect-container">
<img class="mdc-image-list__image" src="images/1-1.jpg">
</div>
<div class="mdc-image-list__supporting">
<span class="mdc-image-list__label">Text label</span>
</div>
</li>
</ul>
</section>
</main>

<script src="/assets/material-components-web.js" async></script>
<script>
demoReady(function() {
[].forEach.call(document.querySelectorAll('.mdc-form-field'), function(el) {
var formField = mdc.formField.MDCFormField.attachTo(el);
var inputEl = el.querySelector('.mdc-checkbox, .mdc-radio');
var input = inputEl.classList.contains('mdc-checkbox') ?
mdc.checkbox.MDCCheckbox.attachTo(inputEl) : mdc.radio.MDCRadio.attachTo(inputEl);
formField.input = input;
});

document.getElementById('toggle-rtl').addEventListener('change', function() {
document.body.setAttribute('dir', this.checked ? 'rtl' : 'ltr');
});

var standardImageListEl = document.getElementById('standard-image-list');

document.getElementById('standard-label-below').addEventListener('change', function() {
standardImageListEl.classList[this.checked ? 'remove' : 'add']('mdc-image-list--protected');
standardImageListEl.classList[this.checked ? 'remove' : 'add']('hide-supporting');
});

document.getElementById('standard-label-protected').addEventListener('change', function() {
standardImageListEl.classList[this.checked ? 'add' : 'remove']('mdc-image-list--protected');
standardImageListEl.classList[this.checked ? 'remove' : 'add']('hide-supporting');
});

document.getElementById('standard-label-none').addEventListener('change', function() {
standardImageListEl.classList[this.checked ? 'remove' : 'add']('mdc-image-list--protected');
standardImageListEl.classList[this.checked ? 'add' : 'remove']('hide-supporting');
});
});
</script>
</body>
</html>
45 changes: 45 additions & 0 deletions demos/image-list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// Copyright 2018 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

@import "./common";
@import "../packages/mdc-checkbox/mdc-checkbox";
@import "../packages/mdc-form-field/mdc-form-field";
@import "../packages/mdc-image-list/mdc-image-list";
@import "../packages/mdc-radio/mdc-radio";

.mdc-image-list.hero-image-list {
@include mdc-image-list-standard-columns(5);
width: 300px;
}

.hero-image-list .mdc-image-list__image {
background-color: #000;
}

.mdc-image-list.standard-image-list {
@include mdc-image-list-standard-columns(5);
max-width: 1000px;
}

.hide-supporting .mdc-image-list__supporting {
display: none;
}

@media (max-width: 599px) {
.mdc-image-list.standard-image-list {
@include mdc-image-list-standard-columns(3);
}
}
8 changes: 8 additions & 0 deletions demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@
</span>
</a>

<a href="image-list.html" role="listitem" class="mdc-list-item">
<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/ic_card_24px.svg" /></span>
<span class="mdc-list-item__text">
Image list
<span class="mdc-list-item__secondary-text">Displaying a collection of images in a repeated pattern</span>
</span>
</a>

<a href="layout-grid.html" role="listitem" class="mdc-list-item">
<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/ic_card_24px.svg" /></span>
<span class="mdc-list-item__text">
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"form-field",
"grid-list",
"icon-toggle",
"image-list",
"layout-grid",
"line-ripple",
"linear-progress",
Expand Down
Loading