Skip to content

Commit 66e63f5

Browse files
committed
fancy render github repos
1 parent 7c22202 commit 66e63f5

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

src/base/_base.scss

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,70 @@
121121
}
122122
}
123123

124+
@mixin link-github($link) {
125+
$userRepo: str-slice(str-slice($link, 8), 1, -1);
126+
$userRepoParts: str-split($userRepo, "/");
127+
$user: nth($userRepoParts, 1);
128+
$repo: nth($userRepoParts, 2);
129+
130+
.messageContent__21e69 a[href^="#{$link}"]:not([href^="channels"]):not([title*="("]) {
131+
font-size: 0;
132+
line-height: 0;
133+
text-decoration: none;
134+
}
135+
.messageContent__21e69 a[href^="#{$link}"]:not([href^="channels"]):not([title*="("])::after {
136+
content: "#{$user} > #{$repo}";
137+
font-size: 11pt !important;
138+
line-height: 10px !important;
139+
color: rgba(255, 255, 255, 0.8);
140+
background: #{$background-normal};
141+
transition: background-color 50ms ease-out, color 50ms ease-out;
142+
cursor: pointer;
143+
border-radius: 3px;
144+
padding: 0 2px;
145+
font-weight: 500;
146+
padding-left: 20px;
147+
}
148+
.messageContent__21e69 a[href^="#{$link}"]:hover::after {
149+
//content: "(" attr(href) ")";
150+
background-color: #{$background-hover};
151+
color: rgba(255, 255, 255, 1);
152+
overflow: hidden;
153+
white-space: nowrap;
154+
text-overflow: ellipsis;
155+
width: 20px;
156+
max-width: 20px;
157+
min-width: 20px;
158+
}
159+
.messageContent__21e69 a[href^="#{$link}"]:not([href^="channels"]):not([title*="("])::before {
160+
position: absolute;
161+
content: "";
162+
background: rgba(255, 255, 255, 0.8);
163+
height: 16px;
164+
width: 16px;
165+
margin-top: 4px;
166+
margin-left: 2px;
167+
-webkit-mask: var(--icon) center/contain no-repeat;
168+
mask: var(--icon) center/contain no-repeat;
169+
}
170+
.messageContent__21e69 a[href^="#{$link}"]:not([href^="channels"]):not([title*="("]):hover::before {
171+
background: rgba(255, 255, 255, 1);
172+
}
173+
@if $icon != "" {
174+
.messageContent__21e69 a[href^="#{$link}"]:not([href^="channels"]):not([title*="("])::before {
175+
--icon: url("#{$icon}");
176+
height: 14px;
177+
width: 14px;
178+
margin-top: 5px;
179+
margin-left: 2px;
180+
}
181+
} @else {
182+
.messageContent__21e69 a[href^="#{$link}"]:not([href^="channels"]):not([title*="("])::before {
183+
--icon: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg width='100%25' height='100%25' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3E%3Crect id='Filled' x='0' y='0' width='24' height='24' style='fill:none;'/%3E%3Cg id='Filled1' serif:id='Filled'%3E%3Cg id='Context'%3E%3Cpath id='copy_message_link' d='M10.473,13.527c0.444,0.423 0.444,1.116 -0,1.538c-0.423,0.423 -1.116,0.423 -1.538,0c-2.098,-2.101 -2.098,-5.556 -0,-7.657l3.834,-3.834c2.101,-2.099 5.556,-2.099 7.657,-0c2.099,2.101 2.099,5.556 0,7.657l-1.613,1.614c0.01,-0.888 -0.13,-1.776 -0.434,-2.621l0.509,-0.52c0.613,-0.607 0.959,-1.434 0.959,-2.296c-0,-0.863 -0.346,-1.69 -0.959,-2.296c-0.606,-0.613 -1.433,-0.959 -2.296,-0.959c-0.862,0 -1.689,0.346 -2.296,0.959l-3.823,3.823c-0.613,0.606 -0.959,1.434 -0.959,2.296c0,0.862 0.346,1.69 0.959,2.296Zm3.054,-4.592c0.423,-0.423 1.116,-0.423 1.538,-0c2.098,2.101 2.098,5.556 0,7.657l-3.834,3.834c-2.101,2.099 -5.556,2.099 -7.657,0c-2.099,-2.101 -2.099,-5.556 -0,-7.657l1.613,-1.614c-0.01,0.888 0.13,1.776 0.434,2.632l-0.509,0.509c-0.613,0.607 -0.959,1.434 -0.959,2.296c0,0.863 0.346,1.69 0.959,2.296c0.606,0.613 1.433,0.959 2.296,0.959c0.862,-0 1.689,-0.346 2.296,-0.959l3.823,-3.823c0.613,-0.606 0.959,-1.434 0.959,-2.296c-0,-0.862 -0.346,-1.69 -0.959,-2.296c-0.212,-0.199 -0.333,-0.478 -0.333,-0.769c-0,-0.291 0.121,-0.57 0.333,-0.769Z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
184+
}
185+
}
186+
}
187+
124188
// ╔══════════════════════════╦═════════════════════════════════════════════════════════════════════════════[─]═[□]═[×]═╗
125189
// ║ Base ║ Discord ║
126190
// ╚══════════════════════════╩═════════════════════════════════════════════════════════════════════════════════════════╝
@@ -337,7 +401,7 @@
337401
// ║ Base ║ GitHub ║
338402
// ╚══════════════════════════╩═════════════════════════════════════════════════════════════════════════════════════════╝
339403

340-
@include link-normal(
404+
@include link-github(
341405
"https://github.com",
342406
"GitHub",
343407
"#18171740",

0 commit comments

Comments
 (0)