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

Add paper-card title components #307

Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Ember Paper Changelog

#master

- [#307](https://github.com/miguelcobain/ember-paper/pull/307) Add paper-card title components

### 0.2.11

- [#253](https://github.com/miguelcobain/ember-paper/pull/253) Add `closeOnClick` to paper-sidenav
Expand Down
6 changes: 6 additions & 0 deletions addon/components/paper-card-title-media.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Ember from 'ember';
import FlexMixin from '../mixins/flex-mixin';

export default Ember.Component.extend(FlexMixin, {
tagName: 'md-card-title-media',
});
7 changes: 7 additions & 0 deletions addon/components/paper-card-title-text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Ember from 'ember';
import FlexMixin from '../mixins/flex-mixin';

export default Ember.Component.extend(FlexMixin, {
tagName: 'md-card-title-text',
classNames: ['paper-card-title-text']
});
6 changes: 6 additions & 0 deletions addon/components/paper-card-title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Ember from 'ember';
import FlexMixin from '../mixins/flex-mixin';

export default Ember.Component.extend(FlexMixin, {
tagName: 'md-card-title',
});
4 changes: 4 additions & 0 deletions app/components/paper-card-title-media.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import PaperCardTitleMedia from 'ember-paper/components/paper-card-title-media';

export default PaperCardTitleMedia;

3 changes: 3 additions & 0 deletions app/components/paper-card-title-text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import PaperCardTitleText from 'ember-paper/components/paper-card-title-text';

export default PaperCardTitleText;
3 changes: 3 additions & 0 deletions app/components/paper-card-title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import PaperCardTitle from 'ember-paper/components/paper-card-title';

export default PaperCardTitle;
61 changes: 60 additions & 1 deletion app/styles/paper-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,67 @@ md-card {
padding: $card-padding;
}

}
md-card-title {
padding: 3 * $card-padding / 2 $card-padding $card-padding;
display: flex;
flex: 1 1 auto;
flex-direction: row;

& + md-card-content {
padding-top: 0;
display: block;

& > p {
&:first-child {
margin-top: 0;
}

&:last-child {
margin-bottom: 0;
}
}

.md-media-xl {
height: 240px;
width: 240px;
}
}

md-card-title-text {
flex: 1;
flex-direction: column;
display: flex;

.md-subhead {
padding-top: 0;
font-size: 14px;
}

&:only-child {
.md-subhead {
padding-top: 3 * $card-padding / 4;
}
}
}

md-card-title-media {
margin-top: - $card-padding / 2;

.md-media-sm {
height: 80px;
width: 80px;
}
.md-media-md {
height: 112px;
width: 112px;
}
.md-media-lg {
height: 152px;
width: 152px;
}
}
}
}
// THEME

$card-border-radius: 2px !default;
Expand Down
6 changes: 6 additions & 0 deletions tests/dummy/app/styles/demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ ul li:first-child {
}

/* DEMO PAGE STYLES */

.card-lg-media-demo {
height: 236px;
width: 400px;
}

.doc-content {
max-width: 864px;
margin: 16px;
Expand Down
33 changes: 33 additions & 0 deletions tests/dummy/app/templates/card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
{{#paper-content class="md-padding"}}
<div class="doc-content">
{{#paper-content class="md-whiteframe-z1 list-demo"}}
{{#paper-card class="card-lg-media-demo"}}
{{#paper-card-title}}
{{#paper-card-title-text}}
<h2>Paracosm</h2>
<p>The titles of Washed Out's breakthrough song and the first single from Paracosm share the...</p>
{{/paper-card-title-text}}
{{#paper-card-title-media}}
<img class="md-media-lg" src="washedout.png">
{{/paper-card-title-media}}
{{/paper-card-title}}
<div class="md-actions" layout="row" layout-align="end center">
{{#paper-button}}Action 1{{/paper-button}}
{{#paper-button}}Action 2{{/paper-button}}
</div>
{{/paper-card}}

{{#paper-card}}
<img src="washedout.png" alt="Washed Out">
{{#paper-card-content}}
Expand Down Expand Up @@ -58,6 +74,23 @@


<h3>Template</h3>
{{#code-block language='handlebars'}}
\{{#paper-card}}
\{{#paper-card-title}}
\{{#paper-card-title-text}}
&lt;h2&gt;Paracosm&lt;/h2&gt;
&lt;p&gt;The titles of Washed Out's breakthrough song and the first single from Paracosm share the...&lt;/p&gt;
\{{/paper-card-title-text}}
\{{#paper-card-title-media}}
&lt;img class="md-media-lg" src="washedout.png"&gt;
\{{/paper-card-title-media}}
\{{/paper-card-title}}
&lt;div class="md-actions" layout="row" layout-align="end center"&gt;
\{{#paper-button}}Action 1\{{/paper-button}}
\{{#paper-button}}Action 2\{{/paper-button}}
&lt;/div&gt;
\{{/paper-card}}{{/code-block}}

{{#code-block language='handlebars'}}
\{{#paper-card}}
&lt;img src="washedout.png" alt="Washed Out"&gt;
Expand Down