1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 12:50:24 +01:00

#1140, update hint.css for licenses

This commit is contained in:
Ahmed Ejaz 2023-08-27 18:17:13 +05:00
parent 1fea611ed6
commit bb22701dd4
2 changed files with 23 additions and 72 deletions

View File

@ -2,7 +2,7 @@
--- ---
@import "../vendor/normalize-css/normalize.css"; @import "../vendor/normalize-css/normalize.css";
@import "../vendor/qtip2/jquery.qtip.min.css"; @import "../vendor/hint.css/hint.min.css";
body { body {
background: #fafafa; background: #fafafa;
@ -461,53 +461,11 @@ strong {
} }
/* Qtip styles */ /* Hint.css Overide */
.orverride-hint-inline {
.qtip-conditions, display: block;
.qtip-permissions,
.qtip-limitations,
.qtip-fetching,
.qtip-error {
font-size: 0.75rem;
line-height: 1.3;
} }
.qtip-conditions {
background-color: #d0ebf6;
border-color: #149ad4;
color: #0d648a;
}
.qtip-conditions .qtip-titlebar {
background-color: #149ad4;
color: #fff;
}
.qtip-fetching,
.qtip-permissions {
background-color: #d8f4d7;
border-color: #3dc637;
color: #298625;
}
.qtip-fetching .qtip-titlebar,
.qtip-permissions .qtip-titlebar {
background-color: #3dc637;
color: #fff;
}
.qtip-error,
.qtip-limitations {
background-color: #f4d9d8;
border-color: #c6403d;
color: #812a28;
}
.qtip-error .qtip-titlebar,
.qtip-limitations .qtip-titlebar {
background-color: #c6403d;
color: #fff;
}
/* For modern browsers */ /* For modern browsers */
.clearfix:before, .clearfix:before,

View File

@ -16,18 +16,17 @@ class Choosealicense
selection.removeAllRanges() selection.removeAllRanges()
selection.addRange(range) selection.addRange(range)
# Qtip position attributes for tooltips tooltipAttributesMapperByRuleType:
qtip_position: permissions:
my: "top center" heading: 'Permissions'
at: "bottom center" color: 'hint--success'
viewport: $(window) conditions:
adjust: heading: 'Conditions'
method: 'shift shift' color: 'hint--info'
# Annotation rule types as defined in `_config.yml` limitations:
ruletypes: heading: 'Limitations'
permissions: "Permission" color: 'hint--error'
conditions: "Condition"
limitations: "Limitation"
# fire on document.ready # fire on document.ready
constructor: -> constructor: ->
@ -41,20 +40,14 @@ class Choosealicense
# Dynamically add annotations as title attribute to rule list items # Dynamically add annotations as title attribute to rule list items
for ruletype, rules of window.annotations for ruletype, rules of window.annotations
for rule in rules for rule in rules
$(".license-#{ruletype} .#{rule["tag"]}").attr "title", rule["description"] licenseLiElement = $(".license-#{ruletype} .#{rule["tag"]}")
tooltipAttr = @tooltipAttributesMapperByRuleType[ruletype]
# Init tooltips on all rule list items licenseLiElement.attr "aria-label", "#{tooltipAttr.heading}: #{rule.description}"
for ruletype, label of @ruletypes licenseLiElement.addClass("hint--bottom
$(".license-#{ruletype} li, .license-#{ruletype} .license-sprite").qtip hint--large
content: hint--no-animate
text: false #{tooltipAttr.color}
title: orverride-hint-inline")
text: label
position: @qtip_position
style:
classes: "qtip-shadow qtip-#{ruletype}"
false
# Initializes Clipboard.js # Initializes Clipboard.js
initClipboard: -> initClipboard: ->