Skip to content

Commit bcc5050

Browse files
committed
Added Custom Website button
Added new Custom Website button which visually looks similar to the previously added Website button with an except of the icon of the new button being the favicon of the chose link. The text on the button is set with the button title, just like the Custom button. The favicon request is performed via the Google API. The icon displays correctly in most cases, with some exceptions. I might add a function later on that displays a generic icon if no icon was found.
1 parent 35b487d commit bcc5050

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

database/seeders/ButtonSeeder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public function run()
1919
[
2020
'name' => 'custom'
2121
],
22+
23+
[
24+
'name' => 'custom_website'
25+
],
2226

2327
[
2428
'name' => 'github'

littlelink/css/brands.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,13 @@ button:hover,
428428
color: #ffffff;
429429
background-color: #000000;
430430
}
431+
432+
/* Custom Website */
433+
.button.button-custom_website {
434+
color: #ffffff;
435+
background-color: #000000;
436+
}
437+
431438
.button.button-web:hover,
432439
.button.button-web:focus {
433440
filter: brightness(90%);

resources/views/littlelink.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ function update_color_scheme() {
132132
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-{{ $link->name }} button hvr-grow hvr-icon-wobble-vertical" href="{{ route('clickNumber') . '/' . $link->id . '/' . $link->link}}" target="_blank"><img class="icon hvr-icon" src="{{ asset('\/littlelink/icons\/') . $linkName }}.svg">{{ $link->title }}</a></div>
133133
@elseif($link->name === "buy me a coffee")
134134
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-coffee button hvr-grow hvr-icon-wobble-vertical" href="{{ route('clickNumber') . '/' . $link->id . '/' . $link->link}}" target="_blank"><img class="icon hvr-icon" src="{{ asset('\/littlelink/icons\/')}}coffee.svg">Buy me a Coffee</a></div>
135+
@elseif($link->name === "custom_website")
136+
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-customwebsite button hvr-grow hvr-icon-wobble-vertical" href="{{ route('clickNumber') . '/' . $link->id . '/' . $link->link}}" target="_blank"><img class="icon hvr-icon" src="http://www.google.com/s2/favicons?domain={{$link->link}}">{{ $link->title }}</a></div>
135137
@else
136138
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-{{ $link->name }} button hvr-grow hvr-icon-wobble-vertical" href="{{ route('clickNumber') . '/' . $link->id . '/' . $link->link}}" target="_blank"><img class="icon hvr-icon" src="{{ asset('\/littlelink/icons\/') . $linkName }}.svg">{{ ucfirst($linkName) }}</a></div>
137139
@endif

resources/views/studio/add-link.blade.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@
2727
<button type="submit" class="mt-3 ml-3 btn btn-info">Submit</button>
2828
</form>
2929

30+
<br><br><details>
31+
<summary>More information</summary>
32+
<pre style="color: grey;">
33+
Always add links with 'http://' or 'https://' before your URLs, otherwise this will cause error when clicking on the link.
34+
Make sure that added URLs don't have a trailing slash at the end of a URL (e.g. 'n.com' instead of 'n.com/') as this causes errors when redirecting to that URL.
35+
36+
The 'Custom' button allows you to add a custom link, where the text on the button is determined with the link title set above.
37+
The 'Custom_website' button functions similar to the Custom button, with the addition of a function that requests the favicon from the chosen URL and uses it as the button icon.
38+
</pre>
39+
</details>
40+
3041
@endsection

0 commit comments

Comments
 (0)