Browse Source

Adds responsive styles for tablet/mobile on item view

pull/1129/head
jlukic 10 years ago
parent
commit
047f900b45
2 changed files with 82 additions and 23 deletions
  1. 70
      src/definitions/views/item.less
  2. 35
      src/themes/packages/default/views/item.variables

70
src/definitions/views/item.less

@ -30,7 +30,7 @@
table-layout: fixed; table-layout: fixed;
display: @display; display: @display;
margin: @margin;
margin: @itemSpacing 0em;
width: @width; width: @width;
min-height: @minHeight; min-height: @minHeight;
background: @background; background: @background;
@ -51,14 +51,14 @@
---------------*/ ---------------*/
.ui.items { .ui.items {
margin: @itemsMargin;
margin: @groupMargin;
} }
.ui.items:first-child { .ui.items:first-child {
margin-top: 0em;
margin-top: 0em !important;
} }
.ui.items:last-child { .ui.items:last-child {
margin-bottom: 0em;
margin-bottom: 0em !important;
} }
/*-------------- /*--------------
@ -110,11 +110,6 @@
border-radius: @borderRadius; border-radius: @borderRadius;
} }
/* Default Image Width */
.ui.items > .item > .image:not(.ui) {
width: @imageWidth;
}
/*-------------- /*--------------
Content Content
@ -144,7 +139,7 @@
display: @contentDisplay; display: @contentDisplay;
margin-left: @contentOffset; margin-left: @contentOffset;
vertical-align: @contentVerticalAlign; vertical-align: @contentVerticalAlign;
padding-left: @contentImagePadding;
padding-left: @contentImageDistance;
} }
.ui.items > .item > .content > .header { .ui.items > .item > .content > .header {
@ -197,6 +192,7 @@
---------------*/ ---------------*/
.ui.items > .item > .content > .description { .ui.items > .item > .content > .description {
max-width: @descriptionMaxWidth;
font-size: @descriptionFontSize; font-size: @descriptionFontSize;
line-height: @descriptionLineHeight; line-height: @descriptionLineHeight;
color: @descriptionColor; color: @descriptionColor;
@ -219,6 +215,7 @@
.ui.items > .item .meta { .ui.items > .item .meta {
font-size: @metaFontSize; font-size: @metaFontSize;
line-height: @metaLineHeight;
color: @metaColor; color: @metaColor;
} }
.ui.items > .item .meta * { .ui.items > .item .meta * {
@ -319,10 +316,10 @@
border-top: @extraDivider; border-top: @extraDivider;
} }
.ui.items > .item .extra > * { .ui.items > .item .extra > * {
margin-right: @extraSpacing;
margin: @extraRowSpacing @extraSpacing 0em 0em;
} }
.ui.items > .item .extra > [class*="right floated"] { .ui.items > .item .extra > [class*="right floated"] {
margin-left: @extraSpacing;
margin: @extraRowSpacing 0em 0em @extraSpacing;
} }
.ui.items > .item .extra:after { .ui.items > .item .extra:after {
@ -335,6 +332,55 @@
} }
/*******************************
Responsive
*******************************/
/* Default Image Width */
.ui.items > .item > .image:not(.ui) {
width: @imageWidth;
}
/* Tablet Only */
@media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) {
.ui.items > .item {
margin: @tabletItemSpacing 0em;
}
.ui.items > .item > .image:not(.ui) {
width: @tabletImageWidth;
}
.ui.items > .item > .image + .content {
display: block;
padding: 0em 0em 0em @tabletContentImageDistance;
}
}
/* Mobily Only */
@media only screen and (max-width: @largestMobileScreen) {
.ui.items > .item {
margin: @mobileItemSpacing 0em;
}
.ui.items > .item > .image {
display: block;
margin-left: auto;
margin-right: auto;
}
.ui.items > .item > .image,
.ui.items > .item > .image > img {
max-width: 100% !important;
width: @mobileImageWidth !important;
max-height: @mobileImageMaxHeight !important;
}
.ui.items > .item > .image + .content {
display: block;
padding: @mobileContentImageDistance 0em 0em;
}
}
/******************************* /*******************************
Variations Variations
*******************************/ *******************************/

35
src/themes/packages/default/views/item.variables

@ -6,14 +6,13 @@
View View
--------------------*/ --------------------*/
/* Items */
@itemsMargin: 1.5em 0em;
/* Group */
@groupMargin: 1.5em 0em;
/* Item */ /* Item */
@display: table; @display: table;
@background: transparent; @background: transparent;
@borderRadius: 0rem; @borderRadius: 0rem;
@margin: 1em 0em;
@minHeight: 0px; @minHeight: 0px;
@padding: 0em; @padding: 0em;
@width: 100%; @width: 100%;
@ -22,6 +21,19 @@
@zIndex: ''; @zIndex: '';
@transition: box-shadow @transitionDuration @transitionEasing; @transition: box-shadow @transitionDuration @transitionEasing;
/* Responsive */
@itemSpacing: 1em;
@imageWidth: 175px;
@contentImageDistance: 1.5em;
@tabletItemSpacing: 1em;
@tabletImageWidth: 150px;
@tabletContentImageDistance: 1em;
@mobileItemSpacing: 2em;
@mobileImageWidth: auto;
@mobileImageMaxHeight: 250px;
@mobileContentImageDistance: 1.5em;
/*------------------- /*-------------------
Content Content
@ -30,7 +42,6 @@
/* Image */ /* Image */
@imageDisplay: table-cell; @imageDisplay: table-cell;
@imageFloat: none; @imageFloat: none;
@imageWidth: 175px;
@imageMaxHeight: ''; @imageMaxHeight: '';
@imageVerticalAlign: top; @imageVerticalAlign: top;
@imageMargin: 0em; @imageMargin: 0em;
@ -43,7 +54,6 @@
/* Content */ /* Content */
@contentDisplay: table-cell; @contentDisplay: table-cell;
@contentVerticalAlign: top; @contentVerticalAlign: top;
@contentImagePadding: 1.5em;
@contentOffset: 0em; @contentOffset: 0em;
@contentBackground: none; @contentBackground: none;
@ -55,13 +65,14 @@
@contentBoxShadow: none; @contentBoxShadow: none;
/* Header */ /* Header */
@headerMargin: 0em;
@headerMargin: -@lineHeightOffset 0em 0em;
@headerFontWeight: bold; @headerFontWeight: bold;
@headerFontSize: 1.2em; @headerFontSize: 1.2em;
@headerColor: @darkTextColor; @headerColor: @darkTextColor;
/* Metadata */ /* Metadata */
@metaFontSize: 1em; @metaFontSize: 1em;
@metaLineHeight: 1em;
@metaSpacing: 0.3em; @metaSpacing: 0.3em;
@metaColor: rgba(0, 0, 0, 0.6); @metaColor: rgba(0, 0, 0, 0.6);
@ -85,8 +96,9 @@
/* Description */ /* Description */
@descriptionDistance: 0.6em; @descriptionDistance: 0.6em;
@descriptionFontSize: 1.1em;
@descriptionLineHeight: 1.2;
@descriptionMaxWidth: 550px;
@descriptionFontSize: 1em;
@descriptionLineHeight: 1.33;
@descriptionColor: @textColor; @descriptionColor: @textColor;
/* Content Image */ /* Content Image */
@ -103,16 +115,17 @@
/* Additional Content */ /* Additional Content */
@extraDivider: none; @extraDivider: none;
@extraSpacing: 0.5em;
@extraSpacing: 0.5rem;
@extraRowSpacing: 0.5rem;
@extraBackground: none; @extraBackground: none;
@extraDisplay: block; @extraDisplay: block;
@extraPosition: relative; @extraPosition: relative;
@extraMargin: 1em 0em 0em;
@extraMargin: (1rem - @extraRowSpacing) 0em 0em;
@extraTop: 0em; @extraTop: 0em;
@extraLeft: 0em; @extraLeft: 0em;
@extraWidth: 100%; @extraWidth: 100%;
@extraPadding: 0.25em 0em 0em;
@extraPadding: 0em 0em 0em;
@extraBoxShadow: none; @extraBoxShadow: none;
@extraColor: @lightTextColor; @extraColor: @lightTextColor;
@extraTransition: color @transitionDuration @transitionEasing; @extraTransition: color @transitionDuration @transitionEasing;

Loading…
Cancel
Save