Skip to content

Commit 7c4b00f

Browse files
committed
feat: add cpopover style
1 parent 4b68c99 commit 7c4b00f

File tree

1 file changed

+139
-5
lines changed

1 file changed

+139
-5
lines changed

scss/vendors/tippyjs/index.scss

Lines changed: 139 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,149 @@
102102
// Popover
103103

104104
.#{$namespace-prefix}-box[data-theme~='cpopover'] {
105-
// background:white;
106-
// color: inherit;
107-
// border: 1px solid rgba(0, 0, 21, 0.2);
105+
z-index: $zindex-popover;
106+
display: block;
107+
max-width: $popover-max-width;
108+
@include reset-text();
109+
@include font-size($popover-font-size);
110+
word-wrap: break-word;
111+
background-clip: padding-box;
112+
border: $popover-border-width solid;
113+
@include border-radius($popover-border-radius);
114+
@include box-shadow($popover-box-shadow);
115+
@include themes($popover-theme-map) {
116+
background-color: themes-get-value("popover-bg");
117+
border-color: themes-get-value("popover-border-color");
118+
}
108119

109120
> .#{$namespace-prefix}-content {
121+
max-width: auto;
110122
padding: 0;
123+
color: initial;
124+
text-align: initial;
125+
background-color: initial;
126+
border-radius: initial;
127+
}
128+
129+
> .#{$namespace-prefix}-arrow {
130+
position: absolute;
131+
display: block;
132+
width: $popover-arrow-width;
133+
height: $popover-arrow-height;
134+
margin: 0 $popover-border-radius;
135+
136+
&::before,
137+
&::after {
138+
position: absolute;
139+
display: block;
140+
content: "";
141+
border-color: transparent;
142+
border-style: solid;
143+
}
144+
}
145+
146+
&[data-placement^='top'] > .#{$namespace-prefix}-arrow {
147+
bottom: subtract(-$popover-arrow-height, $popover-border-width);
148+
149+
&::before {
150+
bottom: 0;
151+
border-width: $popover-arrow-height ($popover-arrow-width / 2) 0;
152+
@include themes($popover-theme-map) {
153+
border-top-color: themes-get-value("popover-arrow-outer-color");
154+
}
155+
}
156+
157+
&::after {
158+
bottom: $popover-border-width;
159+
border-width: $popover-arrow-height ($popover-arrow-width / 2) 0;
160+
@include themes($popover-theme-map) {
161+
border-top-color: themes-get-value("popover-arrow-color");
162+
}
163+
}
164+
}
165+
166+
&[data-placement^='right'] > .#{$namespace-prefix}-arrow {
167+
left: subtract(-$popover-arrow-height, $popover-border-width);
168+
width: $popover-arrow-height;
169+
height: add($popover-arrow-width, (2 * $popover-border-radius));
170+
padding: $popover-border-radius 0; // make sure the arrow does not touch the popover's rounded corners
171+
margin: 0;
172+
173+
&::before {
174+
left: 0;
175+
border-width: ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2) 0;
176+
@include themes($popover-theme-map) {
177+
border-right-color: themes-get-value("popover-arrow-outer-color");
178+
}
179+
}
180+
181+
&::after {
182+
left: $popover-border-width;
183+
border-width: ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2) 0;
184+
@include themes($popover-theme-map) {
185+
border-right-color: themes-get-value("popover-arrow-color");
186+
}
187+
}
188+
}
189+
190+
&[data-placement^='bottom'] > .#{$namespace-prefix}-arrow {
191+
top: subtract(-$popover-arrow-height, $popover-border-width);
192+
193+
&::before {
194+
top: 0;
195+
border-width: 0 ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2);
196+
@include themes($popover-theme-map) {
197+
border-bottom-color: themes-get-value("popover-arrow-outer-color");
198+
}
199+
}
200+
201+
&::after {
202+
top: $popover-border-width;
203+
border-width: 0 ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2);
204+
@include themes($popover-theme-map) {
205+
border-bottom-color: themes-get-value("popover-arrow-color");
206+
}
207+
}
111208
}
112209

113-
> .#{$namespace-prefix}-arrow::before {
114-
color: white;
210+
&[data-placement^='bottom'] {
211+
> .#{$namespace-prefix}-arrow {
212+
right: subtract(-$popover-arrow-height, $popover-border-width);
213+
width: $popover-arrow-height;
214+
height: add($popover-arrow-width, (2 * $popover-border-radius));
215+
padding: $popover-border-radius 0; // make sure the arrow does not touch the popover's rounded corners
216+
margin: 0;
217+
218+
&::before {
219+
right: 0;
220+
border-width: ($popover-arrow-width / 2) 0 ($popover-arrow-width / 2) $popover-arrow-height;
221+
@include themes($popover-theme-map) {
222+
border-left-color: themes-get-value("popover-arrow-outer-color");
223+
}
224+
}
225+
226+
&::after {
227+
right: $popover-border-width;
228+
border-width: ($popover-arrow-width / 2) 0 ($popover-arrow-width / 2) $popover-arrow-height;
229+
@include themes($popover-theme-map) {
230+
border-left-color: themes-get-value("popover-arrow-color");
231+
}
232+
}
233+
}
234+
235+
// This will remove the popover-header's border just below the arrow
236+
.popover-header::before {
237+
position: absolute;
238+
top: 0;
239+
left: 50%;
240+
display: block;
241+
width: $popover-arrow-width;
242+
margin-left: -$popover-arrow-width / 2;
243+
content: "";
244+
border-bottom: $popover-border-width solid;
245+
@include themes($popover-theme-map) {
246+
border-bottom-color: themes-get-value("popover-header-bg");
247+
}
248+
}
115249
}
116250
}

0 commit comments

Comments
 (0)