diff --git a/scripts/tags/link.js b/scripts/tags/link.js index 9be68bd..87812a8 100644 --- a/scripts/tags/link.js +++ b/scripts/tags/link.js @@ -1,36 +1,59 @@ /** - * link.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/ + * link.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) * - * {% link url title [description] [img:src] %} + * {% link url title [description] [icon:src] %} */ 'use strict'; hexo.extend.tag.register('link', function(args) { - args = hexo.args.map(args, ['img'], ['url', 'title', 'description']); + args = hexo.args.map(args, ['icon'], ['url', 'title', 'description']); var el = ''; el += '
'; diff --git a/source/css/_layout/tag-plugins/link.styl b/source/css/_layout/tag-plugins/link.styl index 8946686..eb0d639 100644 --- a/source/css/_layout/tag-plugins/link.styl +++ b/source/css/_layout/tag-plugins/link.styl @@ -1,5 +1,5 @@ .md .tag-plugin.link - max-width: 360px + max-width: 400px margin: 1em auto display: flex justify-content: center @@ -24,26 +24,59 @@ box-shadow: $boxshadow-card-float transform: translateY(-1px) +.md .link-card.plain + flex-direction: row + +.md .link-card.rich + flex-direction: column + align-items: flex-start + width: 400px .md .link-card - div.left,div.right + > div pointer-events: none - div.right + >.top + display: flex + margin: .75rem 1rem .25rem + overflow: hidden + max-width: 'calc(100% - %s * 2)' % 1rem + align-items: center + .img + line-height: 0 + height: 16px + width: 20px + margin-right: 4px + background-repeat: no-repeat + background-size: contain + background-position: left center + .url + opacity: .75 + span + txt-ellipsis() + max-width: 100% + >.bottom + margin: 0 1rem .75rem 1rem + >.right width: 2.5rem height: 2.5rem - margin: 0.75rem + margin: .75rem overflow: hidden flex-shrink: 0 - div.left + >.left overflow: hidden - margin-left: 1rem + margin: .5rem 0 .5rem 1rem + .url + flex-shrink: 0 + txt-ellipsis() span margin: 0 display: block - txt-ellipsis() span.title font-weight: 500 color: var(--text-p1) + line-height: 1.2 + margin: 4px 0 span.url - flex-shrink: 0 color: var(--text-p3) + line-height: 1.4 + margin: 2px 0