瀏覽代碼

Make soft skill's color configurable + add 'sky' and 'orange' colors (#22)

* Add about circle colors for 'sky' and 'orange'

* Make color configurable

Co-authored-by: hossainemruz <emruz@appscode.com>
Jason Tipton 4 年之前
父節點
當前提交
2936164cc1
共有 3 個文件被更改,包括 38 次插入5 次删除
  1. 15 2
      exampleSite/data/sections/about.yaml
  2. 14 2
      layouts/partials/progress/soft-skills.html
  3. 9 1
      static/assets/css/about.css

+ 15 - 2
exampleSite/data/sections/about.yaml

@@ -47,7 +47,7 @@ socialLinks:
 
 # your soft skills
 # give the percentage between 50 to 100 with 5 intervals.
-# currently supported color: blue, yellow, pink, green
+# currently supported colors: blue, yellow, pink, green, sky, orange
 softSkills:
 - name: Leadership
   percentage: 85
@@ -60,4 +60,17 @@ softSkills:
   color: pink
 - name: Hard Working
   percentage: 85
-  color: green
+  color: green
+- name: Fast Learner
+  percentage: 85
+  color: sky
+- name: Problem Solving
+  percentage: 85
+  color: orange
+# you can also provide color code instead of pre-defined color name
+# - name: Example 1
+#   percentage: 75
+#   color: "#00adb5"
+# - name: Example 2
+#   percentage: 65
+#   color: "#8b8383"

+ 14 - 2
layouts/partials/progress/soft-skills.html

@@ -1,12 +1,24 @@
 <div class="col-6 col-lg-4 p-2">
-  <div class="circular-progress {{ .color }}">
+  {{ $predefinedColor:= true}}
+  {{ if hasPrefix .color "#"}}
+    {{ $predefinedColor = false }}
+  {{ end }}
+  <div class="circular-progress {{if $predefinedColor}}{{ .color }}{{end}}">
     <span class="circular-progress-left">
       <span
         class="circular-progress-bar circular-progress-percentage-{{ .percentage }}"
+        {{ if not $predefinedColor }}
+          style="border-color: {{.color}};"
+        {{ end }}
       ></span>
     </span>
     <span class="circular-progress-right">
-      <span class="circular-progress-bar"></span>
+      <span
+      class="circular-progress-bar"
+      {{ if not $predefinedColor }}
+          style="border-color: {{.color}};"
+      {{ end }}
+      ></span>
     </span>
     <div class="circular-progress-value">{{ .name }}</div>
   </div>

+ 9 - 1
static/assets/css/about.css

@@ -100,7 +100,7 @@
 }
 
 .circular-progress.yellow .circular-progress-bar {
-  border-color: #ffc212;
+  border-color: #eebb4d;
 }
 
 .circular-progress.pink .circular-progress-bar {
@@ -111,6 +111,14 @@
   border-color: #2dca73;
 }
 
+.circular-progress.sky .circular-progress-bar {
+  border-color: #00c9e3;
+}
+
+.circular-progress.orange .circular-progress-bar {
+  border-color: #ff7c7c;
+}
+
 .circular-progress-percentage-50 {
   animation: circular-loading-50 0s linear forwards 1.8s;
 }