mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-10-31 00:53:08 +00:00 
			
		
		
		
	Adapt calendar to new tooltip library
This commit is contained in:
		| @@ -315,13 +315,13 @@ export class IcsCalendar extends inheritHtmlElement("div") { | ||||
|             const button = event.target as HTMLButtonElement; | ||||
|             button.classList.add("text-copy"); | ||||
|             if (!button.hasAttribute("position")) { | ||||
|               button.setAttribute("tooltip", gettext("Link copied")); | ||||
|               button.setAttribute("position", "top"); | ||||
|               button.setAttribute("no-hover", ""); | ||||
|             } | ||||
|             if (button.classList.contains("text-copied")) { | ||||
|               button.classList.remove("text-copied"); | ||||
|             } | ||||
|             button.setAttribute("tooltip", gettext("Link copied")); | ||||
|             button.dispatchEvent(new Event("mouseover", { bubbles: true })); | ||||
|             navigator.clipboard.writeText( | ||||
|               new URL( | ||||
|                 await makeUrl(calendarCalendarInternal), | ||||
| @@ -332,6 +332,8 @@ export class IcsCalendar extends inheritHtmlElement("div") { | ||||
|               button.classList.remove("text-copied"); | ||||
|               button.classList.add("text-copied"); | ||||
|               button.classList.remove("text-copy"); | ||||
|               button.dispatchEvent(new Event("mouseout", { bubbles: true })); | ||||
|               button.removeAttribute("tooltip"); | ||||
|             }, 1500); | ||||
|           }, | ||||
|         }, | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| @import "core/static/core/colors"; | ||||
| @import "core/static/core/tooltips"; | ||||
|  | ||||
|  | ||||
| :root { | ||||
| @@ -116,8 +117,4 @@ ics-calendar { | ||||
|     transition: 500ms ease-out; | ||||
|   } | ||||
|  | ||||
|   button.text-copied[tooltip]::before { | ||||
|     opacity: 0; | ||||
|     transition: opacity 500ms ease-out; | ||||
|   } | ||||
| } | ||||
| @@ -45,7 +45,7 @@ body { | ||||
|   } | ||||
| } | ||||
|  | ||||
| .tooltip { | ||||
| @mixin tooltip { | ||||
|   @include shadow; | ||||
|   z-index: 1; | ||||
|   pointer-events: none; | ||||
| @@ -58,7 +58,10 @@ body { | ||||
|   white-space: nowrap; | ||||
|   opacity: 0; | ||||
|   transition: opacity 500ms ease-in; | ||||
| } | ||||
|  | ||||
| .tooltip { | ||||
|   @include tooltip; | ||||
|   position: absolute; | ||||
|   width: max-content; | ||||
|  | ||||
|   | ||||
							
								
								
									
										26
									
								
								core/static/core/tooltips.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								core/static/core/tooltips.scss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| @import "colors"; | ||||
|  | ||||
| .tooltip { | ||||
|   @include shadow; | ||||
|   z-index: 1; | ||||
|   pointer-events: none; | ||||
|   background-color: #333; | ||||
|   color: #fff; | ||||
|   border: 0.5px solid hsl(0, 0%, 50%); | ||||
|   border-radius: 5px; | ||||
|   padding: 5px 10px; | ||||
|   position: absolute; | ||||
|   white-space: nowrap; | ||||
|   opacity: 0; | ||||
|   transition: opacity 500ms ease-out; | ||||
|   position: absolute; | ||||
|   width: max-content; | ||||
|  | ||||
|   left: 0; | ||||
|   top: 0; | ||||
| } | ||||
|  | ||||
| .tooltip[tooltip-status=open] { | ||||
|   opacity: 1; | ||||
|   transition: opacity 500ms ease-in; | ||||
| } | ||||
| @@ -7,6 +7,7 @@ | ||||
|       <link rel="shortcut icon" href="{{ static('core/img/favicon.ico') }}"> | ||||
|       <link rel="stylesheet" href="{{ static('core/base.css') }}"> | ||||
|       <link rel="stylesheet" href="{{ static('core/style.scss') }}"> | ||||
|       <link rel="stylesheet" href="{{ static('core/tooltips.scss') }}"> | ||||
|       <link rel="stylesheet" href="{{ static('core/markdown.scss') }}"> | ||||
|       <link rel="stylesheet" href="{{ static('core/header.scss') }}"> | ||||
|       <link rel="stylesheet" href="{{ static('core/navbar.scss') }}"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user