Skip to content

Commit

Permalink
feat: update clickable, lintk, button and article-list
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Dec 23, 2018
1 parent 23e91af commit 1ce48d0
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 43 deletions.
14 changes: 9 additions & 5 deletions _includes/article-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
{%- elsif include.type == 'brief' -%}
<div class="article-list items">
{%- elsif include.type == 'grid' -%}
<div class="article-list grid grid--p-3">
{%- if include.size == 'sm' -%}
<div class="article-list grid gird--sm grid--p-3">
{%- else -%}
<div class="article-list grid grid--p-3">
{%- endif -%}
{%- endif -%}

{%- for _article in _sorted_list -%}
Expand Down Expand Up @@ -51,7 +55,7 @@
</div>
{%- endif -%}
<div class="item__content">
<header><h2 itemprop="headline" class="item__header"><a href="{{ _article_url }}">{{ _article.title }}</a></h2></header>
<header><a href="{{ _article_url }}"><h2 itemprop="headline" class="item__header">{{ _article.title }}</h2></a></header>
<div class="item__description">
{%- if _article.excerpt and include.show_excerpt -%}
<div class="article__content" itemprop="description articleBody">
Expand Down Expand Up @@ -106,13 +110,13 @@
{%- elsif include.type == 'grid' -%}
{%- if include.size == 'sm' -%}
<div class="cell cell--12 cell--md-4 cell--lg-3">
<div class="card">
<div class="card card--flat">
{%- if _article.cover -%}
<div class="card__image">
<img class="image" src="{{ _article_cover }}" />
<div class="overlay overlay--bottom">
<header>
<a class="card__header" href="{{ _article_url }}">{{ _article.title }}</a>
<a href="{{ _article_url }}"><h2 class="card__header">{{ _article.title }}</h2></a>
</header>
</div>
</div>
Expand All @@ -128,7 +132,7 @@
{%- endif -%}
<div class="card__content">
<header>
<h2 class="card__header"><a href="{{ _article_url }}">{{ _article.title }}</a></h2>
<a href="{{ _article_url }}"><h2 class="card__header">{{ _article.title }}</h2></a>
</header>
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions _sass/common/_classes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

@import
"common/classes/animation",
"common/classes/transform",
"common/classes/transition",
"common/classes/user-select",

"common/classes/clearfix",
"common/classes/media",
"common/classes/clickable",
Expand All @@ -15,8 +19,5 @@
"common/classes/shadow",
"common/classes/spacing",
"common/classes/split-line",
"common/classes/transform",
"common/classes/transition",
"common/classes/user-select",
"common/classes/grid"
;
10 changes: 0 additions & 10 deletions _sass/common/_reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,7 @@ h6 {

a {
font-weight: map-get($base, font-weight-bold);
@include plain() {
text-decoration: none;
}
@include hover() {
text-decoration: underline;
}
@include active() {
text-decoration: none;
}
@include link-colors($main-color-1);
@include transition(map-get($link, transition));
}

pre, code {
Expand Down
8 changes: 3 additions & 5 deletions _sass/common/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ $animation: (
timing-function: ease-in-out
);

$link: (
$clickable: (
transition: all .2s ease-in-out
);

Expand Down Expand Up @@ -134,9 +134,7 @@ $button: (
circle-diameter-sm: $button-height-sm,
circle-diameter-xs: $button-height-xs,

font-weight: map-get($base, font-weight-bold),

transition: all .2s ease-in-out
font-weight: map-get($base, font-weight-bold)
);

$image: (
Expand All @@ -148,6 +146,6 @@ $image: (
);

$menu: (
horizontal-spacer: 1,
horizontal-spacer: 1,
horizontal-item-vertical-spacer: 1
);
9 changes: 9 additions & 0 deletions _sass/common/classes/_clickable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
$ignore-path: true;
}

@include transition(map-get($clickable, transition));
@if $ignore-path == false {
svg {
path {
@include transition(map-get($clickable, transition));
}
}
}

// hover
@if $hover-clr == default {
@if $hover-bg-clr == null {
Expand Down
9 changes: 9 additions & 0 deletions _sass/common/classes/_link.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
@mixin link-colors($clr, $hover-clr: default, $active-clr: default, $focus-clr: null, $theme: default, $ignore-path: false) {
@include plain() {
text-decoration: none;
}
@include hover() {
text-decoration: underline;
}
@include active() {
text-decoration: none;
}
@include clickable($clr, null, $hover-clr, null, $active-clr, null, $focus-clr, null, $theme, $ignore-path);
}
5 changes: 1 addition & 4 deletions _sass/common/components/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
font-weight: map-get($button, font-weight);
line-height: 1 !important;
text-decoration: none !important;
white-space: nowrap;
cursor: pointer;
outline: none;
@include user-select(none);
@include transition(map-get($button, transition));
svg {
width: 1rem;
height: 1rem;
path {
@include transition(map-get($button, transition));
}
}
@include disabled() {
cursor: not-allowed;
Expand Down
4 changes: 2 additions & 2 deletions _sass/common/components/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
padding: map-get($spacers, 2) map-get($spacers, 3);
}

a.card__header, .card__header > a {
.card__header, .card__header > a {
@include link-colors($text-color-d, $main-color-1);
}

Expand Down Expand Up @@ -86,7 +86,7 @@ a.card__header, .card__header > a {
}
}
}
@include transition(map-get($link, transition));
@include transition(map-get($clickable, transition));
}

.card--flat {
Expand Down
6 changes: 5 additions & 1 deletion _sass/common/components/_gallery.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
@include flex(1);
}

.gallery-item{
.gallery-item {
@include flexbox();
@include align-items(center);
@include justify-content(center);
height: 100%;
overflow: hidden;
}

.gallery-item__main {
display: block;
}
2 changes: 1 addition & 1 deletion _sass/common/components/_item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
min-width: 0;
}

a.item__header, .item__header > a {
a > .item__header, a.item__header, .item__header > a {
@include link-colors($text-color-d, $main-color-1);
}

Expand Down
7 changes: 7 additions & 0 deletions _sass/components/_article-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
font-size: map-get($base, font-size-sm);
white-space: nowrap;
}
&.gird--sm {
.card__header {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.article-list__group-header {
margin-top: map-get($spacers, 3);
Expand Down
2 changes: 1 addition & 1 deletion _sass/components/_lightbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
@include hover() {
@include box-shadow(2);
}
@include transition(map-get($link, transition));
@include transition(map-get($clickable, transition));
}
2 changes: 1 addition & 1 deletion _sass/components/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
}
}
@include active() {
@include transition(map-get($link, transition));
@include transition(map-get($clickable, transition));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
style: "max-width: 1000px;"
- title: Enhanced User Experience
children:
- title: Additional styles
- title: Additional Styles
excerpt: TeXt offer some CSS classes for your page, including alert, tag, image, button, etc.
actions:
- text: Learn More
Expand Down
18 changes: 9 additions & 9 deletions docs/samples.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
permalink: /samples.html
---
<div class="layout--articles">
<div class="my-5">
<h2 id="page-layout">Page Layout</h2>
<section class="my-5">
<header><h2 id="page-layout">Page Layout</h2></header>
{%- include article-list.html articles=site.page type='grid' -%}
</div>
</section>

<div class="my-5">
<h2 id="articles-layout">Articles(Home) Layout</h2>
<section class="my-5">
<header><h2 id="articles-layout">Articles(Home) Layout</h2></header>
{%- include article-list.html articles=site.articles type='grid' -%}
</div>
</section>

<div class="my-5">
<h2 id="languages">Languages</h2>
<section class="my-5">
<header><h2 id="languages">Languages</h2></header>
{%- include article-list.html articles=site.languages type='grid' -%}
</div>
</section>
</div>

0 comments on commit 1ce48d0

Please sign in to comment.