To center the Font Awesome icon on the line and have the line visually "cut" into two parts with the icon in the middle, you can adjust the CSS and HTML structure slightly. Here’s how you can achieve that effect:
Updated HTML Template
You will place the icon inside the line and use flexbox to position everything correctly. Here's the updated order-status.component.html:
<div class="container mt-5">
<div class="d-flex flex-column align-items-center">
<ul class="list-unstyled">
<li *ngFor="let orderStatus of orderStatuses; let i = index" class="step">
<div class="circle">{{ i + 1 }}</div>
<div class="status">
<h5>{{ orderStatus.status }}</h5>
<span class="text-muted">{{ orderStatus.date }}</span>
</div>
<div *ngIf="i < orderStatuses.length - 1" class="line-container">
<div class="line"></div>
<i class="fas fa-car icon"></i> <!-- Icon representation -->
<div class="line"></div>
</div>
</li>
</ul>
</div>
</div>
Updated CSS Styles
You'll need to adjust the CSS to center the icon and split the line properly. Here are the updated styles for your order-status.component.css:
.step {
position: relative;
display: flex;
align-items: center;
margin: 20px 0;
}
.circle {
width: 40px;
height: 40px;
border: 2px solid #007bff;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
font-weight: bold;
color: #007bff;
}
.status {
margin-left: 20px;
}
.line-container {
display: flex;
align-items: center;
position: relative;
width: 20px; /* This can adjust to the desired width */
}
.line {
flex: 1;
height: 2px;
background-color: #007bff;
z-index: 1; /* Make the line beneath the icon */
}
.icon {
position: absolute;
left: 50%;
top: -8px; /* Adjust this to center the icon vertically */
transform: translate(-50%, 0); /* Center horizontally */
font-size: 1.5em; /* Adjust icon size */
color: #007bff; /* Icon color */
z-index: 2; /* Bring icon above the line */
}
/* Optional: Adjust colors or sizes */
.circle.completed {
background-color: #007bff;
color: white;
border-color: #0056b3;
}
Explanation of Changes
-
Line Structure: The line-container div wraps around the two lines and the icon, allowing you to position the icon directly in the center.
-
Flexbox for Lines: Each line uses flex: 1 to take up equal space, making it expand to fill the available width.
-
Absolute Positioning for Icon: The icon is absolutely positioned relative to the line-container, making it easy to center at the midpoint of the two lines.
-
Adjustments for Visibility: You can adjust the top value in the .icon class to position the icon vertically relative to the lines as per your design preference.
Final Output
After implementing the above changes, you should see a vertical stepper with circular steps, where the lines are visually cut into two parts, and an icon is centered between them. You can replace the car icon with any other relevant Font Awesome icons as needed.
Feel free to tweak the sizes, colors, and positions to better fit your overall UI design!