Skip to content

Commit aa126cb

Browse files
committed
feat: add customization examples for navigation component in documentation and improve CSS for better layout
1 parent b8828da commit aa126cb

File tree

2 files changed

+62
-38
lines changed

2 files changed

+62
-38
lines changed

docs/components/navigation.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,46 @@ You can customize the navigation buttons using slots:
6868
| `--vc-nav-height` | `30px` | Navigation button height |
6969
| `--vc-nav-width` | `30px` | Navigation button width |
7070

71+
### Customization Examples
72+
73+
There are two ways to customize the navigation appearance:
74+
75+
#### 1. Using CSS Custom Properties
76+
77+
```css
78+
.carousel {
79+
--vc-nav-background: rgba(0, 0, 0, 0.3);
80+
--vc-nav-color: white;
81+
--vc-nav-color-hover: #e5e5e5;
82+
--vc-nav-border-radius: 50%;
83+
--vc-nav-width: 40px;
84+
--vc-nav-height: 40px;
85+
}
86+
```
87+
88+
#### 2. Direct CSS Override
89+
90+
```css
91+
.carousel__next,
92+
.carousel__prev {
93+
background: rgba(0, 0, 0, 0.3);
94+
border-radius: 50%;
95+
width: 40px;
96+
height: 40px;
97+
color: white;
98+
}
99+
100+
.carousel__next:hover,
101+
.carousel__prev:hover {
102+
color: #e5e5e5;
103+
}
104+
105+
.carousel__next--disabled,
106+
.carousel__prev--disabled {
107+
opacity: 0.3;
108+
}
109+
```
110+
71111
## Accessibility
72112

73113
- Buttons include descriptive ARIA labels

src/components/Navigation/Navigation.css

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@
1313
background: var(--vc-nav-background);
1414
border: 0;
1515
border-radius: var(--vc-nav-border-radius);
16-
box-sizing: content-box;
1716
color: var(--vc-nav-color);
1817
cursor: pointer;
1918
display: flex;
2019
font-size: var(--vc-nav-height);
2120
height: var(--vc-nav-height);
2221
justify-content: center;
23-
margin: 0 10px;
2422
padding: 0;
2523
position: absolute;
26-
text-align: center;
27-
top: 50%;
24+
inset-block-start: 50%;
2825
transform: translateY(-50%);
2926
width: var(--vc-nav-width);
3027
}
@@ -36,50 +33,37 @@
3633
}
3734

3835
.carousel__next {
39-
right: 0;
36+
inset-inline-end: 0;
4037
}
4138

4239
.carousel__prev {
43-
left: 0;
40+
inset-inline-start: 0;
4441
}
4542

46-
.carousel.is-btt {
47-
.carousel__next {
48-
top: 0;
49-
}
43+
.carousel.is-vertical {
44+
.carousel__next,
5045
.carousel__prev {
51-
bottom: 0;
46+
inset-inline: auto 50%;
47+
inset-block-start: auto;
48+
transform: translateX(50%);
5249
}
53-
}
5450

55-
.carousel.is-rtl {
56-
.carousel__next {
57-
left: 0;
58-
right: auto;
51+
&.is-ttb {
52+
.carousel__next {
53+
inset-block-end: 0;
54+
}
55+
.carousel__prev {
56+
inset-block-start: 0;
57+
}
5958
}
60-
.carousel__prev {
61-
left: auto;
62-
right: 0;
63-
}
64-
}
6559

66-
.carousel.is-ttb {
67-
.carousel__next {
68-
bottom: 0;
69-
}
70-
.carousel__prev {
71-
top: 0;
72-
}
73-
}
74-
75-
.carousel.is-vertical {
76-
.carousel__next,
77-
.carousel__prev {
78-
left: auto;
79-
margin: 5px auto;
80-
right: 50%;
81-
top: auto;
82-
transform: translate(50%);
60+
&.is-btt {
61+
.carousel__next {
62+
inset-block-start: 0;
63+
}
64+
.carousel__prev {
65+
inset-block-end: 0;
66+
}
8367
}
8468
}
8569

0 commit comments

Comments
 (0)