惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
V
Visual Studio Blog
Martin Fowler
Martin Fowler
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 叶小钗
I
InfoQ
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
P
Proofpoint News Feed
WordPress大学
WordPress大学
小众软件
小众软件
B
Blog
MongoDB | Blog
MongoDB | Blog
人人都是产品经理
人人都是产品经理
量子位
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客

Example blog

Ghost routing explained with routes.yaml examples — routes, collections & taxonomies Ghost redirects explained with practical redirects.yaml examples How to Serve JSON or XML Data in Ghost How to Change Your Default Post Template in Ghost Ghost Custom Theme Settings How to add Google Fonts to Ghost Themes How to Configure Ghost with Mailgun Ghost Theme Structure & Organization How to Make Custom Templates in Ghost Themes How to Install Ghost CMS via Ghost-CLI How to Add Syntax Highlighting to Ghost The best Ghost CMS hosting platforms Ghost 6.0 — Social Web and Native Ghost Analytics Ghost CMS Social web beta, email 2FA and more author social links How to keep custom design settings when updating your Ghost theme How to use the public preview card in Ghost How to add members-specific sections in Ghost How to customize the default content CTA in Ghost How to build a custom homepage in Ghost An overview of Ghost editor cards and and how they work Ghost CMS News: One-time payments & collecting sales tax How to customize the private site access template in Ghost How to add custom fonts in Ghost themes Ghost CMS News: Additional payment methods & internal linking How to use Code Injection in Ghost How to set meta data of your custom routes & collections in Ghost Ghost CMS News: TK reminders, ActivityPub and improvements How to format dates and use the date helper in Ghost Ghost CMS internationalization, custom fonts & spam protection Understanding and optimizing post and page settings in Ghost CMS
Ghost Snippets: Custom Progress Cards & Steps
Bright Themes · 2022-08-02 · via Example blog

You can use progress indicators to add visual elements in your post and to inform users about state or progress. We have two types of progress indicators: progress cards and progress steps.

With the help of the progress cards, you can highlight the progress in percent values with the help of a linear indicator filled between 0 and 100%.

Progress steps can be used to display progress through a sequence with numbered steps.

Progress elements & markup

You will have to use the HTML card as we need a specific markup for this to work. Here is the code that will be used for the progress cards:

<div class="progress-card">
  <div class="progress-card-content">
    <span class="progress-title">Information gathering</span>
    <span class="progress-description"
      >he focus of the first step is to gather all the necessary information for
      the project. Ask relevant questions to go deeper into the business
      needs.</span
    >
  </div>
  <span class="progress-bar" style="--value:25%;"></span>
</div>

<div class="progress-card" style="--color-accent: #7FFFD4">
  <div class="progress-card-content">
    <span class="progress-title">Planning and strategy, wireframing</span>
    <span class="progress-description"
      >Using the information gathered from phase one, it is time to put it
      together and make a detailed website plan. At this point, a site map is
      developed.</span
    >
  </div>
  <span class="progress-bar" style="--value:60%;"></span>
</div>

<div class="progress-card" style="--color-accent: #00FFFF">
  <div class="progress-card-content">
    <span class="progress-title">Graphical design</span>
    <span class="progress-description"
      >As a part of the design process, it is essential to carefully and
      tastefully apply such visual elements as the logo and brand colors, to
      strengthen the brand identity on the website. During the design phase, the
      team usually creates one or more prototypes for the website.
    </span>
  </div>
  <span class="progress-bar" style="--value:40%;"></span>
</div>

<div class="progress-card" style="--color-accent: #FF7F50">
  <div class="progress-card-content">
    <span class="progress-title">Development/build</span>
    <span class="progress-description"
      >At this point, the design itself should be ready. But it is usually in
      the form of static images. It requires extra development effort to
      translate it into HTML/CSS, and then to add a layer of animations or
      JavaScript, depending on the complexity of the design.</span
    >
  </div>
  <span class="progress-bar" style="--value:75%;"></span>
</div>

Here is the code that will be used for the progress steps:

<div class="progress-step" style="--color-accent: #FF7F50">
  <div class="progress-step-item" data-status="active">
    <span class="number">1</span>
    <span class="description">Problem</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">2</span>
    <span class="description">Goal</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">3</span>
    <span class="description">Users</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">4</span>
    <span class="description">Success</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">5</span>
    <span class="description">Resources</span>
  </div>
</div>

<div class="progress-step" style="--color-accent: #FF7F50">
  <div class="progress-step-item" data-status="complete">
    <span class="number">1</span>
    <span class="description">Problem</span>
  </div>

  <div class="progress-step-item" data-status="active">
    <span class="number">2</span>
    <span class="description">Goal</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">3</span>
    <span class="description">Users</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">4</span>
    <span class="description">Success</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">5</span>
    <span class="description">Resources</span>
  </div>
</div>

<div class="progress-step" style="--color-accent: #FF7F50">
  <div class="progress-step-item" data-status="complete">
    <span class="number">1</span>
    <span class="description">Problem</span>
  </div>

  <div class="progress-step-item" data-status="complete">
    <span class="number">2</span>
    <span class="description">Goal</span>
  </div>

  <div class="progress-step-item" data-status="active">
    <span class="number">3</span>
    <span class="description">Users</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">4</span>
    <span class="description">Success</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">5</span>
    <span class="description">Resources</span>
  </div>
</div>

<div class="progress-step" style="--color-accent: #FF7F50">
  <div class="progress-step-item" data-status="complete">
    <span class="number">1</span>
    <span class="description">Problem</span>
  </div>

  <div class="progress-step-item" data-status="complete">
    <span class="number">2</span>
    <span class="description">Goal</span>
  </div>

  <div class="progress-step-item" data-status="complete">
    <span class="number">3</span>
    <span class="description">Users</span>
  </div>

  <div class="progress-step-item" data-status="active">
    <span class="number">4</span>
    <span class="description">Success</span>
  </div>

  <div class="progress-step-item" data-status="incomplete">
    <span class="number">5</span>
    <span class="description">Resources</span>
  </div>
</div>

<div class="progress-step" style="--color-accent: #FF7F50">
  <div class="progress-step-item" data-status="complete">
    <span class="number">1</span>
    <span class="description">Problem</span>
  </div>

  <div class="progress-step-item" data-status="complete">
    <span class="number">2</span>
    <span class="description">Goal</span>
  </div>

  <div class="progress-step-item" data-status="complete">
    <span class="number">3</span>
    <span class="description">Users</span>
  </div>

  <div class="progress-step-item" data-status="complete">
    <span class="number">4</span>
    <span class="description">Success</span>
  </div>

  <div class="progress-step-item" data-status="active">
    <span class="number">5</span>
    <span class="description">Resources</span>
  </div>
</div>

Progress card & step styling

Let's start styling our progress cards. You can add this in Code Injection in the Ghost Admin.

.progress-card {
  --color-accent: #333;
  --color-border: #e4e4e4;
  width: 100%;
  border-radius: 5px;
  margin-bottom: 2em;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-bottom: 0;
}

.progress-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-accent);
  opacity: 0.05;
}

.progress-card.orange {
  --color-accent: #ffc48b;
}
.progress-card.purple {
  --color-accent: #b4b3ff;
}
.progress-card.pink {
  --color-accent: #ffb3c0;
}

.progress-card-content {
  padding: 1em;
}

.progress-card .progress-bar {
  background-color: var(--color-border);
  display: block;
  width: 100%;
  height: 5px;
  position: relative;
}

.progress-card .progress-bar::before {
  content: '';
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  height: 5px;
  background-color: var(--color-accent);
  opacity: 0.15;
}

.progress-card .progress-bar::after {
  content: '';
  width: var(--value);
  position: absolute;
  left: 0;
  top: 0;
  height: 5px;
  background-color: var(--color-accent);
}

.progress-title {
  font-weight: 600;
  margin-bottom: 0.25em;
  opacity: 0.9;
}

.progress-description {
  font-size: 0.9rem;
  opacity: 0.85;
}

.progress-card span {
  display: block;
}

Here is the styling for the progress steps:

.progress-step {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 4em;
  --color-accent: #8056d6;
  --color-border: #e0e0e0;
  font-weight: 500;
}

.progress-step span.number {
  height: 1.2em;
  width: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5em;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background-color: #f8f8f8;
}

.progress-step::before {
  background-color: var(--color-border);
  content: '';
  height: 2px;
  position: absolute;
  right: 0;
  top: calc(50% - 1px);
  width: 100%;
  z-index: -1;
}

.progress-step-item[data-status='complete'] .number {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.progress-step-item[data-status='active'] .number {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.progress-step-item[data-status='complete'] .description {
  opacity: 1;
}

.progress-step-item[data-status='active'] .description {
  color: var(--color-accent);
}

.progress-step div {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.progress-step .description {
  position: absolute;
  top: 3.5em;
  font-size: 0.85rem;
  opacity: 0.8;
}

The final result

Ghost CMS Progress Card
Ghost CMS Progress Card

You can change the color of the progress cards, by changing the value of the --color-accent property on the first row of each div HTML element, if you don't specify a color the default black will be used, like for the first element in the code example.

Ghost CMS Progress Step
Ghost CMS Progress Step

To manage the filled part of the bottom line you have to change the --value property of the span element of the progress card. You can even create a snippet out of it, so you don't have to remember the markup.

You can remove and add rows, and also steps. You can do this by deleting or adding a div HTML element. A row element is a div element with the progress-step class, a step element is a div element with the progress-step-item class.

The progress step can be incomplete, active, and complete. You can specify this by changing the value of the data-status property for each progress-step-item element.
You can change the color of the progress step, by changing the value of the --color-accent property for each progress-step element.

Creating a snippet out of the markup will make it easy to include it anywhere in your posts.