Skip to content

Commit

Permalink
feat: card component, config and some other small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Sep 14, 2018
1 parent 337b743 commit 7aceb10
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 31 deletions.
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ paths:
##############################
## excerpt
excerpt_separator: <!--more-->
excerpt_type: html # text (default), html

## license
license: CC-BY-NC-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"
Expand Down
3 changes: 1 addition & 2 deletions _includes/article-footer/author-profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
{%- assign _author_itemtype = 'http://schema.org/Person' -%}
{%- endif -%}

<div itemscope itemtype="{{ _author_itemtype }}" class="author-profile card card--no-shadow item">

<div itemscope itemtype="{{ _author_itemtype }}" class="author-profile card card--flat item">
{%- if _author.avatar -%}
{%- if _author.url -%}
<a href="{{ _author.url }}" class="item__image">
Expand Down
8 changes: 4 additions & 4 deletions _includes/article-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{%- assign _sorted_list = _sorted_list | reverse -%}
{%- endif -%}

{%- if include.type == 'common' -%}
{%- if include.type == 'item' -%}
<div class="article-list items items--divided">
{%- elsif include.type == 'brief' -%}
<div class="article-list items">
Expand All @@ -31,7 +31,7 @@
{%- assign _article_cover = __return -%}
{%- endif -%}

{%- if include.type == 'common' -%}
{%- if include.type == 'item' -%}
{%- if include.article_type == 'BlogPosting' -%}
<article class="item" itemscope itemtype="http://schema.org/BlogPosting">
{%- else -%}
Expand Down Expand Up @@ -103,7 +103,7 @@
{%- elsif include.type == 'grid' -%}
{%- if include.size == 'sm' -%}
<div class="cell cell--3 cell--md-4 cell--sm-12">
<div class="new-card">
<div class="card">
{%- if _article_cover -%}
<div class="card__image">
<img class="image" src="{{ _article_cover }}" />
Expand All @@ -119,7 +119,7 @@
{%- else -%}

<div class="cell cell--4 cell--md-6 cell--sm-12">
<div class="new-card card--flat">
<div class="card card--flat">
{%- if _article_cover -%}
<div class="card__image"><img src="{{ _article_cover }}" /></div>
{%- endif -%}
Expand Down
5 changes: 4 additions & 1 deletion _layouts/articles.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
{%- assign _articles = layout -%}
{%- when 'paginator' -%}
{%- assign _articles = paginator -%}
{%- else -%}
{%- assign _articles = site[_key] -%}
{%- else -%}
{%- endcase -%}
{%- else -%}
{%- assign _articles = _articles[_key] -%}
Expand Down Expand Up @@ -72,7 +75,7 @@
{%- assign _cover_size = page.articles.cover_size | default: layout.articles.cover_size -%}
{%- assign _excerpt_type = page.articles.excerpt_type | default: layout.articles.excerpt_type -%}

{%- include article-list.html articles=_articles type='common'
{%- include article-list.html articles=_articles type='item'
article_type=_article_type
show_cover=_show_cover cover_size=_cover_size
show_excerpt=_show_excerpt excerpt_type=_excerpt_type
Expand Down
12 changes: 8 additions & 4 deletions _sass/additional/_alert.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
.article__content {
p.success {
@include card(false);
padding: .5rem 1rem;
background-color: rgba($green, .1);
border: 1px solid $green;
border-radius: map-get($base, border-radius);
}

p.info {
@include card(false);
padding: .5rem 1rem;
background-color: rgba($blue, .1);
border: 1px solid $blue;
border-radius: map-get($base, border-radius);
}

p.warning {
@include card(false);
padding: .5rem 1rem;
background-color: rgba($yellow, .1);
border: 1px solid $yellow;
border-radius: map-get($base, border-radius);
}

p.error {
@include card(false);
padding: .5rem 1rem;
background-color: rgba($red, .1);
border: 1px solid $red;
border-radius: map-get($base, border-radius);
}
}
17 changes: 1 addition & 16 deletions _sass/common/components/_card.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
@mixin card($has-shadow: default) {
@if $has-shadow == default {
$has-shadow: true;
}
padding: .5rem 1rem;
border-radius: map-get($base, border-radius);
@if $has-shadow {
@include box-shadow();
}
}

.card {
@include card();
}


.new-card {
max-width: 18rem;
border-radius: map-get($base, border-radius);
@include box-shadow();
Expand All @@ -30,7 +15,7 @@
}

.cell {
& > .new-card {
& > .card {
max-width: unset;
}
}
Expand Down
1 change: 1 addition & 0 deletions _sass/components/_author-profile.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.author-profile {
max-width: 25rem;
padding: .5rem 1rem;
margin: map-get($base, vertical-space-lg) 0;
font-size: map-get($base, font-size-sm);
background-color: $text-background-color;
Expand Down
1 change: 0 additions & 1 deletion docs/_config.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ paths:
##############################
## excerpt
excerpt_separator: <!--more-->
excerpt_type: html # text (default), html

## license
license: CC-BY-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"
Expand Down
1 change: 0 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ paths:
##############################
## excerpt
excerpt_separator: <!--more-->
excerpt_type: html # text (default), html

## license
license: CC-BY-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"
Expand Down
10 changes: 10 additions & 0 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,22 @@ docs-en:
url: /docs/en/additional-styles
- title: Extra
children:
- title: Spacing
url: /docs/en/spacing
- title: Grid
url: /docs/en/grid
- title: Icons
url: /docs/en/icons
- title: Image
url: /docs/en/image
- title: Button
url: /docs/en/button
- title: Item
url: /docs/en/item
- title: Card
url: /docs/en/card
- title: Hero
url: /docs/en/hero
- title: Languages
children:
- title: 中文
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
layout: home
# articles:
# excerpt_type: html
---
1 change: 0 additions & 1 deletion test/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ paths:
##############################
## excerpt
excerpt_separator: <!--more-->
excerpt_type: html # text (default), html

## license
license: CC-BY-NC-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"
Expand Down
2 changes: 2 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
layout: home
# articles:
# excerpt_type: html
---

0 comments on commit 7aceb10

Please sign in to comment.