mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
card updates
This commit is contained in:
@ -3,6 +3,7 @@ export * from 'ionic/components/app/app'
|
||||
export * from 'ionic/components/action-menu/action-menu'
|
||||
export * from 'ionic/components/aside/aside'
|
||||
export * from 'ionic/components/button/button'
|
||||
export * from 'ionic/components/card/card'
|
||||
export * from 'ionic/components/checkbox/checkbox'
|
||||
export * from 'ionic/components/content/content'
|
||||
export * from 'ionic/components/icon/icon'
|
||||
|
@ -38,14 +38,14 @@ ion-app,
|
||||
margin-bottom: 1rem;
|
||||
|
||||
&:first-child {
|
||||
margin-top: -0.4rem;
|
||||
margin-top: -0.3rem;
|
||||
}
|
||||
}
|
||||
|
||||
h1 + h2,
|
||||
h1 + h3,
|
||||
h2 + h3 {
|
||||
margin-top: -0.4rem;
|
||||
margin-top: -0.3rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
@ -1,47 +1,23 @@
|
||||
|
||||
// Card
|
||||
// --------------------------------------------------
|
||||
$card-border-color: #ccc !default;
|
||||
$card-border-radius: 2px !default;
|
||||
$card-box-shadow: 0 1px 3px rgba(0, 0, 0, .3) !default;
|
||||
|
||||
.card {
|
||||
position: relative;
|
||||
|
||||
.card.card {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.card {
|
||||
|
||||
.card-header, .card-footer, .card-content {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.card .item-label {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.card .item {
|
||||
&:first-child {
|
||||
border-top-left-radius: $card-border-radius;
|
||||
border-top-right-radius: $card-border-radius;
|
||||
|
||||
.item-content {
|
||||
border-top-left-radius: $card-border-radius;
|
||||
border-top-right-radius: $card-border-radius;
|
||||
}
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom-right-radius: $card-border-radius;
|
||||
border-bottom-left-radius: $card-border-radius;
|
||||
|
||||
.item-content {
|
||||
border-bottom-right-radius: $card-border-radius;
|
||||
border-bottom-left-radius: $card-border-radius;
|
||||
}
|
||||
}
|
||||
.card-header,
|
||||
.card-footer {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
20
ionic/components/card/card.ts
Normal file
20
ionic/components/card/card.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import {ElementRef} from 'angular2/angular2';
|
||||
|
||||
import {Ion} from '../ion';
|
||||
import {IonicConfig} from '../../config/config';
|
||||
import {IonicDirective} from '../../config/annotations';
|
||||
import {ListVirtualScroll} from './virtual';
|
||||
import * as util from 'ionic/util';
|
||||
|
||||
|
||||
@IonicDirective({
|
||||
selector: 'ion-card',
|
||||
host: {
|
||||
'class': 'list'
|
||||
}
|
||||
})
|
||||
export class Card extends Ion {
|
||||
constructor(elementRef: ElementRef, ionicConfig: IonicConfig) {
|
||||
super(elementRef, ionicConfig);
|
||||
}
|
||||
}
|
@ -2,39 +2,40 @@
|
||||
// iOS Card
|
||||
// --------------------------------------------------
|
||||
|
||||
$card-ios-background-color: #fff !default;
|
||||
$card-ios-box-shadow: 0 1px 2px rgba(0,0,0,.3) !default;
|
||||
$card-ios-border-radius: 2px !default;
|
||||
$card-ios-font-size: 1.4rem !default;
|
||||
$card-ios-item-content-padding: 15px !default;
|
||||
$card-ios-background-color: #fff !default;
|
||||
$card-ios-box-shadow: 0 1px 2px rgba(0,0,0,.3) !default;
|
||||
$card-ios-border-radius: 2px !default;
|
||||
$card-ios-font-size: 1.4rem !default;
|
||||
|
||||
$card-ios-header-background-color: $card-ios-background-color !default;
|
||||
$card-ios-header-padding: 10px;
|
||||
$card-ios-footer-background-color: $card-ios-background-color !default;
|
||||
$card-ios-footer-padding: 10px;
|
||||
|
||||
|
||||
.mode-ios .card {
|
||||
.card[mode="ios"] {
|
||||
background: $card-ios-background-color;
|
||||
box-shadow: $card-ios-box-shadow;
|
||||
border-radius: $card-ios-border-radius;
|
||||
font-size: $card-ios-font-size;
|
||||
|
||||
.item,
|
||||
.item-content {
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
.item::before,
|
||||
.item::after {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.item:last-of-type .item-content:after {
|
||||
background: transparent;
|
||||
.item:first-child:before {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
font-size: 1.7rem;
|
||||
padding: $card-ios-header-padding;
|
||||
background-color: $card-ios-footer-background-color;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
color: #6d6d72;
|
||||
}
|
||||
|
||||
.item-content {
|
||||
padding: $card-ios-item-content-padding
|
||||
padding: $card-ios-footer-padding;
|
||||
background-color: $card-ios-footer-background-color;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
// iOS Card
|
||||
// Material Design Card
|
||||
// --------------------------------------------------
|
||||
|
||||
$card-md-background-color: #fff !default;
|
||||
@ -9,7 +9,7 @@ $card-md-font-size: 1.4rem !default;
|
||||
$card-md-item-content-padding: 15px !default;
|
||||
|
||||
|
||||
[mode="md"] .card {
|
||||
.card[mode="md"] {
|
||||
background: $card-md-background-color;
|
||||
box-shadow: $card-md-box-shadow;
|
||||
border-radius: $card-md-border-radius;
|
||||
|
@ -1,69 +1,56 @@
|
||||
|
||||
<ion-view nav-title="Card">
|
||||
<ion-toolbar><ion-title>Basic Cards</ion-title></ion-toolbar>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<div class="list-header">
|
||||
List Header
|
||||
<ion-card>
|
||||
<div class="card-header">
|
||||
Card Header
|
||||
</div>
|
||||
<div class="item item-text-wrap">
|
||||
<div class="item-content">
|
||||
Keep close to Nature's heart... and break clear away, once in awhile, and climb a mountain or spend a week in the woods. Wash your spirit clean.
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
Card Footer
|
||||
</div>
|
||||
</ion-card>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
New Post
|
||||
</div>
|
||||
<div class="card-content">
|
||||
Keep close to Nature's heart... and break clear away, once in awhile, and climb a mountain or spend a week in the woods. Wash your spirit clean.
|
||||
</div>
|
||||
<div style="width:100%; height: 180px; background: gray"></div>
|
||||
<div class="card-footer">
|
||||
Posted 5 days ago
|
||||
</div>
|
||||
|
||||
<ion-card>
|
||||
|
||||
<div class="item">
|
||||
<icon name="ion-location"></icon>
|
||||
<div class="item-content">
|
||||
All Out Card
|
||||
</div>
|
||||
<button primary outline>View</button>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<div class="item card-header">
|
||||
<div class="item-content">
|
||||
<div class="item-label">
|
||||
Card Header
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-content">
|
||||
<div class="item-label">
|
||||
I met her in a club down in old Soho,
|
||||
where you drink champagne and it tastes just like Cola cola,
|
||||
C-O-L-A cola.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-content">
|
||||
<div class="item-label">
|
||||
She walked up to me and she asked me to dance.
|
||||
I asked her name and in a dark brown voice she said, "Lola",
|
||||
L-O-L-A Lola, lo lo lo lo Lola
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item card-footer">
|
||||
<div class="item-content">
|
||||
<div class="item-label">
|
||||
Card Footer
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item item-text-wrap">
|
||||
<div class="item-content">
|
||||
This is a multiline content within a card that should
|
||||
take up multiple lines and stuff.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-footer">
|
||||
List Footer
|
||||
<div class="item">
|
||||
<div class="item-content">
|
||||
<icon small name="ion-star"></icon>
|
||||
<span>255</span>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<icon small name="ion-reply"></icon>
|
||||
<span>Reply</span>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<icon small name="ion-forward"></icon>
|
||||
Forward
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
<div class="card-footer">
|
||||
Card Footer
|
||||
</div>
|
||||
|
||||
</ion-view>
|
||||
</ion-card>
|
||||
|
1
ionic/components/card/test/images/e2e.ts
Normal file
1
ionic/components/card/test/images/e2e.ts
Normal file
@ -0,0 +1 @@
|
||||
|
7
ionic/components/card/test/images/index.ts
Normal file
7
ionic/components/card/test/images/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import {App} from 'ionic/ionic';
|
||||
|
||||
|
||||
@App({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
class IonicApp {}
|
63
ionic/components/card/test/images/main.html
Normal file
63
ionic/components/card/test/images/main.html
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
<ion-toolbar><ion-title>Card Images</ion-title></ion-toolbar>
|
||||
|
||||
|
||||
<ion-card>
|
||||
<div class="item">
|
||||
<div style="background:gray; width:100%; height:120px"></div>
|
||||
</div>
|
||||
<div class="item no-border-bottom">
|
||||
<div class="item-content">
|
||||
<h4 style="color:gray">Item with no-border-bottom</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item item-text-wrap">
|
||||
<div class="item-content">
|
||||
<p>This is content text and stuff.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="item-content">
|
||||
<a href="#">Like</a>
|
||||
</div>
|
||||
<div class="item-content align-right">
|
||||
<a href="#">Share</a>
|
||||
</div>
|
||||
</div>
|
||||
</ion-card>
|
||||
|
||||
|
||||
<ion-card>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-media">
|
||||
<div class="avatar" style="background:gray; width:100px; height:100px"></div>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<h2>Card With An Inset Picture</h2>
|
||||
<p>Isn't it beautiful</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-content">
|
||||
<div style="background:gray; width:100%; height:120px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-content">
|
||||
<icon small name="ion-star"></icon>
|
||||
<span>255</span>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<icon small name="ion-reply"></icon>
|
||||
<span>Reply</span>
|
||||
</div>
|
||||
<div class="item-content">
|
||||
<icon small name="ion-forward"></icon>
|
||||
Forward
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ion-card>
|
1
ionic/components/card/test/links/e2e.ts
Normal file
1
ionic/components/card/test/links/e2e.ts
Normal file
@ -0,0 +1 @@
|
||||
|
7
ionic/components/card/test/links/index.ts
Normal file
7
ionic/components/card/test/links/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import {App} from 'ionic/ionic';
|
||||
|
||||
|
||||
@App({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
class IonicApp {}
|
81
ionic/components/card/test/links/main.html
Normal file
81
ionic/components/card/test/links/main.html
Normal file
@ -0,0 +1,81 @@
|
||||
|
||||
<ion-toolbar><ion-title>Card with Links</ion-title></ion-toolbar>
|
||||
|
||||
|
||||
<ion-card>
|
||||
|
||||
<a class="item" href="#">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Link 1
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</a>
|
||||
|
||||
<a class="item" href="#">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Link 2
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</a>
|
||||
|
||||
<button class="item">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Button 1
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</button>
|
||||
|
||||
<button class="item">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Button 2
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</button>
|
||||
|
||||
</ion-card>
|
||||
|
||||
|
||||
<ion-card>
|
||||
|
||||
<div class="card-header">
|
||||
Card Header
|
||||
</div>
|
||||
|
||||
<a class="item" href="#">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Link 1
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</a>
|
||||
|
||||
<a class="item" href="#">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Link 2
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</a>
|
||||
|
||||
<a class="item" href="#">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Link 3
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</a>
|
||||
|
||||
<a class="item" href="#">
|
||||
<icon name="ion-ionic"></icon>
|
||||
<div class="item-content">
|
||||
Link 4
|
||||
</div>
|
||||
<icon forward></icon>
|
||||
</a>
|
||||
|
||||
</ion-card>
|
||||
|
@ -18,3 +18,7 @@ icon {
|
||||
display: inline-block;
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
icon[small] {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
@ -48,6 +48,9 @@ button.item {
|
||||
min-width: 26px;
|
||||
text-align: center;
|
||||
}
|
||||
icon[small]:first-child {
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
&.activated {
|
||||
background-color: #d9d9d9;
|
||||
@ -65,7 +68,8 @@ button.item {
|
||||
icon + .item-content,
|
||||
.item-content + icon,
|
||||
.item-media + .item-content,
|
||||
.item-content + .item-media {
|
||||
.item-content + .item-media,
|
||||
.item-content + .item-content {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@ -129,24 +133,24 @@ button.item {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.item a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.item.item.item.no-border-bottom:after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.item.item.item.no-border-bottom + .item::before {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.item.item.item.no-border-bottom + .item {
|
||||
margin-top: -13px;
|
||||
}
|
||||
|
||||
/*
|
||||
.item {
|
||||
position: relative;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
width: 100%;
|
||||
min-height: $item-min-height;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
text-align: initial;
|
||||
}
|
||||
|
||||
.item-group {
|
||||
}
|
||||
.item-group-title {
|
||||
display: block;
|
||||
padding: $item-padding;
|
||||
@ -188,105 +192,6 @@ ion-primary-swipe-buttons {
|
||||
}
|
||||
|
||||
|
||||
// Item Content
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-content {
|
||||
// TODO add proper bg to cover up swipe buttons
|
||||
background: white;
|
||||
transform: translate3d(0,0,0);
|
||||
|
||||
position: relative;
|
||||
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
width: 100%;
|
||||
min-height: $item-min-height;
|
||||
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.item-label {
|
||||
position: relative;
|
||||
|
||||
//display: flex;
|
||||
flex: 1;
|
||||
flex-shrink: 1;
|
||||
|
||||
// To enable multi-line text more easily
|
||||
flex-direction: column;
|
||||
|
||||
max-width: 100%;
|
||||
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.item-content {
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Item Media (Icons, checkboxes, images, etc.)
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-media {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
|
||||
max-width: 100%;
|
||||
min-height: $item-min-height;
|
||||
padding: 0;
|
||||
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.item-media + .item-label {
|
||||
padding-left: $item-padding;
|
||||
}
|
||||
|
||||
.item-media:last-child {
|
||||
//padding-right: $item-padding;
|
||||
}
|
||||
|
||||
.item-note {
|
||||
color: #aaa;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.item-avatar {
|
||||
padding-top: ($item-padding / 2) - 1;
|
||||
padding-bottom: ($item-padding / 2) + 1;
|
||||
|
||||
img {
|
||||
max-width: 40px;
|
||||
max-height: 40px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.item-full {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Some testing things
|
||||
|
||||
.item-media-placeholder {
|
||||
|
@ -14,6 +14,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-content">
|
||||
Column
|
||||
</div>
|
||||
<div class="item-content">
|
||||
Column
|
||||
</div>
|
||||
<div class="item-content">
|
||||
Column
|
||||
</div>
|
||||
<div class="item-content">
|
||||
Column
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-content align-left">
|
||||
align-left
|
||||
</div>
|
||||
<div class="item-content align-center">
|
||||
align-center
|
||||
</div>
|
||||
<div class="item-content align-right">
|
||||
align-right
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="item-content item-text-wrap">
|
||||
Multiline text that should wrap when it is too long to fit on one line in the item. Class on .item-content
|
||||
@ -43,7 +70,7 @@
|
||||
|
||||
<div class="item item-text-wrap">
|
||||
<div class="item-content">
|
||||
<h4>H4 Title Text</h4>
|
||||
<h4>H3 Title Text</h4>
|
||||
<p>Paragraph line 1</p>
|
||||
<p>Paragraph line 2</p>
|
||||
<p>Paragraph line 3</p>
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
Aside, Button, Content, Scroll, Refresher,
|
||||
Slides, Slide, SlidePager,
|
||||
Tabs, Tab,
|
||||
List, Item, ItemGroup, ItemGroupTitle,
|
||||
Card, List, Item, ItemGroup, ItemGroupTitle,
|
||||
Toolbar,
|
||||
Icon,
|
||||
IconDirective,
|
||||
@ -38,6 +38,7 @@ export const IonicDirectives = [
|
||||
forwardRef(() => Refresher),
|
||||
|
||||
// Lists
|
||||
forwardRef(() => Card),
|
||||
forwardRef(() => List),
|
||||
forwardRef(() => Item),
|
||||
forwardRef(() => ItemGroup),
|
||||
|
@ -1,4 +1,16 @@
|
||||
|
||||
.align-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.align-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.no-transition {
|
||||
transition: none !important;
|
||||
}
|
||||
|
Reference in New Issue
Block a user