Skip to content

Commit

Permalink
chore: refactor styles to fit hexo-component-inferno 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoffice committed Oct 4, 2020
1 parent 0587d69 commit 0856a59
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 25 deletions.
41 changes: 35 additions & 6 deletions include/style/article.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,33 @@ $article-font-size ?= 1.1rem

article
&.media
color: $text-light

a
color: inherit

&:hover
color: $primary

.image
width: 64px
height: 64px

img
object-fit: cover
width: 100%
height: 100%

.title
@extend .is-size-6
margin-bottom: .25em

.date, .categories
@extend .is-size-7

.categories
@extend .is-uppercase

.media-content
color: $text-light

Expand Down Expand Up @@ -60,10 +87,11 @@ article
footer
strong + cite
margin-left: .5em

.message.message-immersive
border-radius: 0
margin: 0 0-($card-content-padding) $card-content-padding 0-($card-content-padding)
margin: 0 0 - $card-content-padding $card-content-padding 0 - $card-content-padding

.message-body
border: none

Expand Down Expand Up @@ -116,7 +144,7 @@ article
content: '\f25e'
font-size: 200px
font-family: 'Font Awesome 5 Brands'
opacity: 0.1
opacity: .1

.level-left
flex-wrap: wrap
Expand All @@ -130,7 +158,7 @@ article
@extend .mb-1

a
@extend .size-small, .has-text-grey
@extend .is-size-7, .has-text-grey

.licensing-meta
.level-item
Expand All @@ -144,8 +172,8 @@ article
vertical-align: bottom

h6
@extend .size-small
@extend .is-size-7

a
color: inherit

Expand All @@ -156,6 +184,7 @@ a
flex-shrink: 1
word-wrap: break-word
white-space: normal

&.article-nav-next
span
text-align: right
Expand Down
3 changes: 3 additions & 0 deletions include/style/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ $body-background-color ?= #f7f7f7
$family-sans-serif ?= Ubuntu, Roboto, 'Open Sans', 'Microsoft YaHei', sans-serif
$family-code ?= 'Source Code Pro', monospace, 'Microsoft YaHei'

$size-7 ?= .85rem
$size-small ?= .75rem

$primary ?= $blue
$custom-colors ?= {
grey-lightest: {
Expand Down
24 changes: 24 additions & 0 deletions include/style/donate.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ $donate-qrcode-max-width ?= 280px
$donate-qrcode-shadow ?= $card-shadow
$donate-qrcode-box-radius ?= $card-radius

$donate-button-colors ?= {
'afdian': rgb(136, 95, 217),
'alipay': rgb(0, 160, 232),
'buymeacoffee': rgb(255, 221, 0),
'paypal': rgb(254, 183, 0),
'patreon': rgb(255, 66, 77),
'wechat': rgb(26, 173, 25),
}

.donate
position: relative

Expand Down Expand Up @@ -32,3 +41,18 @@ $donate-qrcode-box-radius ?= $card-radius
&:last-child:not(:first-child)
.qrcode
right: -.75rem

for $name, $color in $donate-button-colors
&[data-type={'"' + $name + '"'}]
color: findColorInvert($color)
background-color: $color
border-color: transparent

&:active
background-color: darken($color, 5%)

&:hover
background-color: darken($color, 2.5%)

&:focus:not(:active)
box-shadow: 0 0 0 .125em rgba($color, .25)
9 changes: 0 additions & 9 deletions include/style/helper.styl
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ for n in (0 .. 5)
&:hover
color: $primary !important

/* ---------------------------------
* Font helpers
* --------------------------------- */
.size-small
font-size: .85rem !important

.line-height-inherit
line-height: inherit !important

/* ---------------------------------
* Image helpers
* --------------------------------- */
Expand Down
3 changes: 3 additions & 0 deletions include/style/pagination.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ $pagination-background-color ?= $button-background-color
$post-navigation-fg ?= $grey

.pagination
@extend .pagination.is-centered
margin-top: 1.5rem

.pagination-link,
.pagination-ellipsis,
.pagination-previous,
Expand Down
27 changes: 27 additions & 0 deletions include/style/widget.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.widget
.menu-list
li
ul
margin-right: 0

.level
margin-bottom: 0

.level-left, .level-right, .level-item
flex-shrink: 1

.level-left, .level-right
align-items: flex-start

.tag
background: $light-grey
color: $white-invert

.tags
.tag:first-child
background: $primary
color: $primary-invert

.tag:last-child
background: $light-grey
color: $white-invert
6 changes: 3 additions & 3 deletions layout/common/article.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = class extends Component {
</div> : null}
{/* Metadata */}
<article class={`card-content article${'direction' in page ? ' ' + page.direction : ''}`} role="article">
{page.layout !== 'page' ? <div class="article-meta size-small is-uppercase level is-mobile">
{page.layout !== 'page' ? <div class="article-meta is-size-7 is-uppercase level is-mobile">
<div class="level-left">
{/* Creation Date */}
{page.date && <span class="level-item" dangerouslySetInnerHTML={{
Expand Down Expand Up @@ -89,14 +89,14 @@ module.exports = class extends Component {
{!index && article && article.licenses && Object.keys(article.licenses)
? <ArticleLicensing.Cacheable page={page} config={config} helper={helper} /> : null}
{/* Tags */}
{!index && page.tags && page.tags.length ? <div class="article-tags size-small mb-4">
{!index && page.tags && page.tags.length ? <div class="article-tags is-size-7 mb-4">
<span class="mr-2">#</span>
{page.tags.map(tag => {
return <a class="link-muted mr-2" rel="tag" href={url_for(tag.path)}>{tag.name}</a>;
})}
</div> : null}
{/* "Read more" button */}
{index && page.excerpt ? <a class="article-more button is-small size-small" href={`${url_for(page.link || page.path)}#more`}>{__('article.more')}</a> : null}
{index && page.excerpt ? <a class="article-more button is-small is-size-7" href={`${url_for(page.link || page.path)}#more`}>{__('article.more')}</a> : null}
{/* Share button */}
{!index ? <Share config={config} page={page} helper={helper} /> : null}
</article>
Expand Down
2 changes: 1 addition & 1 deletion layout/common/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Footer extends Component {
<a class="footer-logo is-block mb-2" href={siteUrl}>
{footerLogo}
</a>
<p class="size-small">
<p class="is-size-7">
<span dangerouslySetInnerHTML={{ __html: `&copy; ${siteYear} ${author || siteTitle}` }}></span>
&nbsp;&nbsp;Powered by <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>&nbsp;&&nbsp;
<a href="https://github.com/ppoffice/hexo-theme-icarus" target="_blank" rel="noopener">Icarus</a>
Expand Down
4 changes: 2 additions & 2 deletions layout/widget/profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class Profile extends Component {
followTitle,
socialLinks
} = this.props;
return <div class="card widget">
return <div class="card widget" data-type="profile">
<div class="card-content">
<nav class="level">
<div class="level-item has-text-centered flex-shrink-1">
<div>
<figure class="image is-128x128 mx-auto mb-2">
<img class={'avatar' + (avatarRounded ? ' is-rounded' : '')} src={avatar} alt={author} />
</figure>
{author ? <p class="title is-size-4 is-block line-height-inherit">{author}</p> : null}
{author ? <p class="title is-size-4 is-block" style={{'line-height': 'inherit'}}>{author}</p> : null}
{authorTitle ? <p class="is-size-6 is-block">{authorTitle}</p> : null}
{location ? <p class="is-size-6 is-flex justify-content-center">
<i class="fas fa-map-marker-alt mr-1"></i>
Expand Down
4 changes: 0 additions & 4 deletions source/css/cyberpunk.styl
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,6 @@ article.article
.article-licensing
background: $black-ter

.licensing-title
a
@extend .size-small, .has-text-grey

.content
blockquote
background: transparent
Expand Down
1 change: 1 addition & 0 deletions source/css/style.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@import '../../include/style/timeline'
@import '../../include/style/search'
@import '../../include/style/codeblock'
@import '../../include/style/widget'
@import '../../include/style/donate'
@import '../../include/style/plugin'
@import '../../include/style/responsive'

0 comments on commit 0856a59

Please sign in to comment.