From 6523081c1e3b38279e737b2c0c7c8e7c92466330 Mon Sep 17 00:00:00 2001 From: EGOIST <0x142857@gmail.com> Date: Thu, 27 Jun 2019 15:55:12 +0800 Subject: [PATCH] fix: add missing css for page content (#41) * add styling for links * add styling for blockquote * fix color for back button * fix image width * more stylings * fix post card --- demo/pages/_posts/my-first-post.md | 100 +++++++++++++++++- .../src/components/HomeProfile.vue | 7 +- .../src/components/PostCard.vue | 17 ++- .../src/components/PostMeta.vue | 1 - .../saber-theme-portfolio/src/css/global.css | 59 ++++++++++- .../src/css/variables.css | 10 ++ .../src/layouts/post.vue | 1 + 7 files changed, 185 insertions(+), 10 deletions(-) diff --git a/demo/pages/_posts/my-first-post.md b/demo/pages/_posts/my-first-post.md index 6bebf3c..b3487bb 100644 --- a/demo/pages/_posts/my-first-post.md +++ b/demo/pages/_posts/my-first-post.md @@ -6,12 +6,102 @@ tags: - life --- -Consectetur nostrud elit do do do nisi quis. Cillum commodo Lorem sunt non sit velit nostrud fugiat. Et ad anim sint veniam occaecat nulla eu id irure occaecat nulla excepteur elit sint. Tempor dolor dolore aute excepteur nisi Lorem incididunt excepteur magna sint proident in voluptate dolore. Anim eiusmod ea sint velit enim irure est enim duis eiusmod. Culpa ea ea duis anim esse culpa anim laborum proident deserunt quis nisi. Laborum in irure aute consectetur enim cillum incididunt mollit. +## Text -Ullamco non incididunt adipisicing duis. Laborum consectetur occaecat veniam nisi amet consectetur laborum cupidatat culpa aute dolor id. Velit consectetur officia commodo elit. Qui officia adipisicing irure laboris non ullamco est cupidatat eu non Lorem excepteur. Ex cupidatat aliqua eu amet consequat Lorem excepteur reprehenderit consectetur. +```markdown +It's very easy to make some words **bold** and other words _italic_ with Markdown. +You can even [link to Google!](http://google.com) +``` -Adipisicing nulla sunt ipsum ipsum ea Lorem aliquip et incididunt cillum eiusmod aliquip Lorem culpa. Voluptate laborum id eu exercitation esse aliqua id reprehenderit enim consequat dolor eu excepteur. Qui ut est ex aute ullamco exercitation id. Commodo reprehenderit exercitation et incididunt officia aute eu nostrud nisi eiusmod ipsum. +It's very easy to make some words **bold** and other words _italic_ with Markdown. +You can even [link to Google!](http://google.com) -Do occaecat consectetur nisi proident excepteur pariatur esse nisi. Aute magna proident consectetur mollit Lorem non est ad ea non proident. Anim reprehenderit ut adipisicing commodo veniam sit. Nostrud eu sint labore culpa proident laborum do adipisicing nostrud esse. Nostrud anim adipisicing irure aliquip incididunt ea ea. +## Lists -Cupidatat id occaecat proident officia. Laboris in incididunt ut dolor in qui amet nostrud ad exercitation minim nulla consectetur. Occaecat dolor labore eu nostrud nulla nulla ex dolore. +```markdown +Sometimes you want numbered lists: + +1. One +2. Two +3. Three + +Sometimes you want bullet points: + +- Start a line with a star +- Profit! + +Alternatively, + +- Dashes work just as well +- And if you have sub points, put two spaces before the dash or star: + - Like this + - And this +``` + +Sometimes you want numbered lists: + +1. One +2. Two +3. Three + +Sometimes you want bullet points: + +- Start a line with a star +- Profit! + +Alternatively, + +- Dashes work just as well +- And if you have sub points, put two spaces before the dash or star: + - Like this + - And this + +## Images + +If you want to embed images, this is how you do it: + +```markdown +![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png) +``` + +![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png) + +## Blockquotes + +If you'd like to quote someone, use the > character before the line: + +```markdown +> Coffee. The finest organic suspension ever devised... I beat the Borg with it. - Captain Janeway +``` + +> Coffee. The finest organic suspension ever devised... I beat the Borg with it. - Captain Janeway + +## Code + +And if you'd like to use syntax highlighting, optionally include the language: + +````markdown +```javascript +if (isAwesome) { + return true +} +``` +```` + +```javascript +if (isAwesome) { + return true +} +``` + +## Task Lists + +But I have to admit, tasks lists are my favorite: + +```markdown +- [x] This is a complete item +- [ ] This is an incomplete item +``` + +- [x] This is a complete item +- [ ] This is an incomplete item diff --git a/packages/saber-theme-portfolio/src/components/HomeProfile.vue b/packages/saber-theme-portfolio/src/components/HomeProfile.vue index 3a2b911..cc373c5 100644 --- a/packages/saber-theme-portfolio/src/components/HomeProfile.vue +++ b/packages/saber-theme-portfolio/src/components/HomeProfile.vue @@ -136,8 +136,12 @@ export default { .profile-meta-items { margin-top: 25px; + & a { + color: var(--profile-link-color); + } + & a:hover { - color: var(--text-color-lighter); + color: var(--profile-link-hover-color); } } @@ -164,6 +168,7 @@ export default { padding: 10px 0; font-size: 1.2rem; width: 100%; + color: var(--profile-link-color); & svg { width: 1rem; diff --git a/packages/saber-theme-portfolio/src/components/PostCard.vue b/packages/saber-theme-portfolio/src/components/PostCard.vue index 1f6cfe8..cb9a8f9 100644 --- a/packages/saber-theme-portfolio/src/components/PostCard.vue +++ b/packages/saber-theme-portfolio/src/components/PostCard.vue @@ -3,12 +3,12 @@
{{ post.attributes.title }}
-
+ @@ -34,6 +34,8 @@ export default { methods: { getExcerpt(excerpt) { const limit = 240 + // Strip HTML + excerpt = excerpt.replace(/<(?:.|\n)*?>/gm, '') return excerpt.length > limit ? `${excerpt.slice(0, limit)}...` : excerpt } } @@ -41,13 +43,24 @@ export default {