Skip to content

Commit 5b63080

Browse files
committed
Added custom spaces and headings
Added custom spaces and headings users can add like buttons to their littlelink pages to divide button sections into groups. Spaces can be changed via the number in the title, and one space equals one "<br>". The maximum spaces that can be added with one space 'button' is capped at 10. The 'Space' button will be replaced with an empty space, so buttons could be visually separated into groups. Entering a number between 1-10 in the title section will change the empty space's distance. The 'Heading' button will be replaced with a sub-heading, where the title defines the text on that heading.
1 parent a65509b commit 5b63080

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

app/Http/Controllers/UserController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ public function showButtons()
9292
//Save add link
9393
public function addLink(request $request)
9494
{
95+
if ($request->button == 'heading' or $request->button == 'space')
96+
$request->validate([
97+
'link' => '',
98+
'title' => '',
99+
'button' => 'required'
100+
]);
101+
else
95102
$request->validate([
96103
'link' => 'required',
97104
'title' => '',

database/seeders/ButtonSeeder.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ public function run()
179179
[
180180
'name' => 'website'
181181
],
182+
183+
[
184+
'name' => 'header'
185+
],
186+
187+
[
188+
'name' => 'space'
189+
],
182190
];
183191

184192
Button::insert($buttons);

resources/views/littlelink.blade.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,17 @@ function get_operating_system() {
208208
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-custom_website 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>
209209
@elseif($link->name === "custom_website" and $link->custom_css != "")
210210
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button hvr-grow hvr-icon-wobble-vertical" style="{{ $link->custom_css }}" 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>
211+
@elseif($link->name === "space")
212+
<?php
213+
if (is_numeric($link->title) and $link->title < 10)
214+
echo str_repeat("<br>",$link->title);
215+
elseif (is_numeric($link->title) and $link->title >= 10)
216+
echo str_repeat("<br>",10);
217+
else
218+
echo "<br><br><br>"
219+
?>
220+
@elseif($link->name === "heading")
221+
<h2>{{ $link->title }}</h2>
211222
@else
212223
<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>
213224
@endif

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
<pre style="color: grey;">
3333
The 'Custom' button allows you to add a custom link, where the text on the button is determined with the link title set above.
3434
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.
35+
36+
The 'Space' button will be replaced with an empty space, so buttons could be visually separated into groups. Entering a number between 1-10 in the title section will change the empty space's distance.
37+
The 'Heading' button will be replaced with a sub-heading, where the title defines the text on that heading.
3538
</pre>
3639
</details>
3740

0 commit comments

Comments
 (0)