Skip to content

Commit

Permalink
feat(curtana): simply offset calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Jan 19, 2017
1 parent 3df01f7 commit 020c34e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
48 changes: 24 additions & 24 deletions _app/assets/themes/curtana/_less/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ body:hover .latest {
flex-direction: column;
justify-content: center;
background: fade(@text-color, 2%);
.padding-offset(@space-lg, @space-lg);
.margin-offset(-@space-lg, -@space-lg);
.padding-offset(@space-lg);
.margin-offset(-@space-lg);

@media (max-width: @breakpoint-md) {
min-height: calc(50vh - @nav-padding * 2 - 3ex);
padding-top: 16vmin;
padding-bottom: 16vmin;
.padding-offset(@space-md, @space-md);
.margin-offset(-@space-md, -@space-md);
.padding-offset(@space-md);
.margin-offset(-@space-md);
}

@media (max-width: @breakpoint-sm) {
.padding-offset(@space-sm, @space-sm);
.margin-offset(-@space-sm, -@space-sm);
.padding-offset(@space-sm);
.margin-offset(-@space-sm);
}

h1 {
Expand Down Expand Up @@ -265,8 +265,8 @@ body:hover .latest {
iframe,
.browser {
display: block;
width: calc(100% + (@space-md * 2) + (@border-default * 2));
margin: 0 calc(-@space-md - @border-default) 1.8rem;
width: calc(100% + (@space-md * 2));
margin: 0 -@space-md 1.8rem;

@media (max-width: @breakpoint-md) {
width: calc(100% + (@space-md * 2));
Expand Down Expand Up @@ -304,8 +304,8 @@ body:hover .latest {
}

&.size-small {
width: calc(100% + (@space-xs * 2) + (@border-default * 2));
.margin-offset(calc(-@space-xs - @border-default));
width: calc(100% + (@space-xs * 2));
.margin-offset(-@space-xs);

@media (max-width: @breakpoint-md) {
width: calc(100% + (@space-md * 2));
Expand Down Expand Up @@ -354,7 +354,7 @@ body:hover .latest {
blockquote {
position: relative;
margin-bottom: 2.8rem;
margin-left: calc(-@space-xs - @border-default);
margin-left: -@space-xs;
font-size: 90%;

@media (max-width: @breakpoint-sm) {
Expand All @@ -381,7 +381,7 @@ body:hover .latest {

@media (max-width: @breakpoint-sm) {
.padding-offset(calc(@space-sm - @border-default), @space-sm);
.margin-offset(-@space-sm, -@space-sm);
.margin-offset(-@space-sm);
}
}

Expand Down Expand Up @@ -475,7 +475,7 @@ body:hover .latest {
.highlight > pre,
.highlighter-rouge .highlight {
padding: @space-xs;
.margin-offset(-@space-xs, -@space-xs);
.margin-offset(-@space-xs);
margin-bottom: 1.8rem;
overflow-x: auto;
font-size: 80%;
Expand All @@ -484,13 +484,13 @@ body:hover .latest {
-webkit-overflow-scrolling: touch;

@media (max-width: @breakpoint-md) {
.padding-offset(@space-md, @space-md);
.margin-offset(-@space-md, -@space-md);
.padding-offset(@space-md);
.margin-offset(-@space-md);
}

@media (max-width: @breakpoint-sm) {
.padding-offset(@space-sm, @space-sm);
.margin-offset(-@space-sm, -@space-sm);
.padding-offset(@space-sm);
.margin-offset(-@space-sm);
}
}

Expand Down Expand Up @@ -538,7 +538,7 @@ body:hover .latest {
border-spacing: 0;
font-size: 90%;
width: 100%;
.margin-offset(-@space-xs, -@space-xs);
.margin-offset(-@space-xs);
margin-bottom: 1.8rem;

// TODO: responsive table support
Expand All @@ -557,12 +557,12 @@ body:hover .latest {
// TODO: responsive table support
@media (max-width: @breakpoint-md) {
width: calc(100% + (@space-md * 2));
.margin-offset(-@space-md, -@space-md);
.margin-offset(-@space-md);
}

@media (max-width: @breakpoint-sm) {
width: calc(100% + (@space-sm * 2));
.margin-offset(-@space-sm, -@space-sm);
.margin-offset(-@space-sm);

// TODO: table shadow support
// Darker shadow for mobile devices
Expand Down Expand Up @@ -722,10 +722,10 @@ body:hover .latest {
// Extra offset for OS X screenshots
.screenshot-mac {
@osx-shadow-size: 56px;
.margin-offset(-@osx-shadow-size, -@osx-shadow-size);
.margin-offset(-@osx-shadow-size);

@media (max-width: @breakpoint-md), (max-width: @breakpoint-sm) {
.margin-offset(0, 0);
.margin-offset(0);
}
}

Expand All @@ -734,12 +734,12 @@ body:hover .latest {
.store,
.download {
padding-left: @space-xs;
margin-left: calc(-@space-xs - @border-default);
margin-left: -@space-xs;
border-left: @border-default solid @link-color;

@media (max-width: @breakpoint-sm) {
.padding-offset(calc(@space-sm - @border-default), @space-sm);
.margin-offset(-@space-sm, -@space-sm);
.margin-offset(-@space-sm);
}
}

Expand Down
4 changes: 2 additions & 2 deletions _app/assets/themes/curtana/_less/reset.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ body {
font-feature-settings: @font-features;

@media (max-width: @breakpoint-md) {
.padding-offset(@space-md, @space-md);
.padding-offset(@space-md);
font-size: (@font-size * 1.4);
}

@media (max-width: @breakpoint-sm) {
.padding-offset(@space-sm, @space-sm);
.padding-offset(@space-sm);
font-size: (@font-size * 2.4);
}

Expand Down

0 comments on commit 020c34e

Please sign in to comment.