File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed
src/components/extendedTooltip Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @nordcloud/gnui" ,
33 "description" : " Nordcloud Design System - a collection of reusable React components used in Nordcloud's SaaS products" ,
4- "version" : " 8.9.1 " ,
4+ "version" : " 8.10.0 " ,
55 "license" : " MIT" ,
66 "repository" : {
77 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -409,6 +409,21 @@ import { SVGIcon } from "../svgicon";
409409 <button type = " button" >Hover Me!</button >
410410 </ExtendedTooltip >
411411 </div >
412+ <div
413+ style = { {
414+ display: " flex" ,
415+ flexDirection: " column" ,
416+ alignItems: " center" ,
417+ }}
418+ >
419+ <span style = { { color: " purple" , marginBottom: " 2rem" }} >Accent</span >
420+ <ExtendedTooltip
421+ caption = " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sollicitudin."
422+ status = " accent"
423+ >
424+ <button type = " button" >Hover Me!</button >
425+ </ExtendedTooltip >
426+ </div >
412427 </div >
413428 </Story >
414429</Canvas >
Original file line number Diff line number Diff line change @@ -11,15 +11,14 @@ import {
1111 Placement ,
1212 Position ,
1313} from "../../utils/position" ;
14- import { setColor } from "../../utils/setcolor" ;
1514import { useTooltipHover } from "../tooltip/hooks" ;
1615
1716type Timeout = {
1817 showTimeout ?: number ;
1918 hideTimeout ?: number ;
2019} ;
2120
22- type Status = "danger" | "notification" | "success" | "warning" ;
21+ type Status = "accent" | " danger" | "notification" | "success" | "warning" ;
2322
2423export type ExtendedTooltipProps = Timeout & {
2524 caption : React . ReactNode ;
@@ -171,10 +170,27 @@ const TooltipWrapper = styled.div<TooltipWrapperProps>`
171170
172171function getColor ( status : Status ) {
173172 return css `
174- background-color : ${ setColor ( status ) } ;
173+ background-color : ${ changeStatus ( status ) } ;
175174 color : ${ theme . color . text . text04 } ;
176175 & : after {
177- border-top-color : ${ setColor ( status ) } ;
176+ border-top-color : ${ changeStatus ( status ) } ;
178177 }
179178 ` ;
180179}
180+
181+ const changeStatus = ( status ?: Status ) => {
182+ switch ( status ) {
183+ case "danger" :
184+ return theme . color . interactive . error ;
185+ case "warning" :
186+ return theme . color . interactive . warning ;
187+ case "success" :
188+ return theme . color . interactive . success ;
189+ case "notification" :
190+ return theme . color . interactive . info ;
191+ case "accent" :
192+ return theme . color . interactive . accent ;
193+ default :
194+ return theme . color . interactive . primary ;
195+ }
196+ } ;
You can’t perform that action at this time.
0 commit comments