Skip to content

Commit 4e7dbc5

Browse files
committed
refactor(DocsCard): iconset shows icons side by side with a plus in between
1 parent 5e652b8 commit 4e7dbc5

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

src/components/global/DocsCard/index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ function DocsCard(props: Props): JSX.Element {
3434
)}
3535
{props.ionicon && <ion-icon name={props.ionicon} className="Card-ionicon"></ion-icon>}
3636
{props.iconset && (
37-
<div className="Card-iconset__container">
38-
{props.iconset.split(',').map((icon, index) => (
39-
<img
40-
src={useBaseUrl(icon)}
41-
className={`Card-icon ${index === props.activeIndex ? 'Card-icon-active' : ''}`}
42-
data-index={index}
43-
key={index}
44-
/>
37+
<div className="Card-icon-row">
38+
{props.iconset.split(',').map((icon, index, array) => (
39+
<React.Fragment key={index}>
40+
<img src={useBaseUrl(icon)} className="Card-icon Card-icon-default" />
41+
{index < array.length - 1 && (
42+
<div className="Card-plus-icon">
43+
<span>+</span>
44+
</div>
45+
)}
46+
</React.Fragment>
4547
))}
4648
</div>
4749
)}

src/components/global/DocsCard/styles.module.scss

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,19 @@ docs-card[disabled]::after {
116116

117117
.Card-icon-row {
118118
position: relative;
119+
display: flex;
120+
gap: 8px;
119121
}
120122

121-
.Card-iconset__container {
122-
position: relative;
123-
}
124-
125-
.Card-iconset__container .Card-icon {
126-
position: absolute;
127-
opacity: 0;
128-
transition: 0.8s opacity;
129-
}
130-
131-
.Card-iconset__container .Card-icon--active {
132-
opacity: 1;
123+
.Card-plus-icon {
124+
display: flex;
125+
align-items: center;
126+
justify-content: center;
127+
width: 24px;
128+
height: 48px;
129+
color: var(--docs-card-border-c);
130+
font-size: 22px;
131+
font-weight: 600;
133132
}
134133

135134
.Card-ionicon {

src/components/global/DocsCards/cards.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ docs-cards {
22
display: grid;
33
font-size: 12px;
44
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
5-
grid-gap: 1.35rem;
5+
gap: 1.35rem;
6+
}
7+
8+
docs-cards:has(docs-card:only-child) {
9+
grid-template-columns: 1fr 1fr;
610
}
711

812
docs-cards > docs-card {

0 commit comments

Comments
 (0)