This repository has been archived by the owner on Oct 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use a regular links with special attributes for external li…
…nks (#19)
- Loading branch information
1 parent
4b0cbaa
commit f392e15
Showing
9 changed files
with
67 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 4 additions & 8 deletions
12
...snapshots__/LinkRendererTest__it_should_render_external_links_with_(ftpgoogle.com)__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
<a | ||
href="ftp://google.com" | ||
class="link font-semibold inline space-x-1 whitespace-nowrap" | ||
target="_blank" | ||
rel="noopener nofollow noreferrer" | ||
> | ||
<span>Label</span> | ||
</a> | ||
<a href="ftp://google.com" title="Title" target="_blank" data-external="true">Label <svg wire:key="GfLVwv0b" class="fill-current w-4 h-4 inline ml-1 -mt-1.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
<path d="M23.251 7.498V.748h-6.75m6.75 0l-15 15m3-10.5h-9a1.5 1.5 0 00-1.5 1.5v15a1.5 1.5 0 001.5 1.5h15a1.5 1.5 0 001.5-1.5v-9" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path> | ||
</svg> | ||
</a> |
12 changes: 4 additions & 8 deletions
12
.../__snapshots__/LinkRendererTest__it_should_render_external_links_with_(google.com)__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
<a | ||
href="//google.com" | ||
class="link font-semibold inline space-x-1 whitespace-nowrap" | ||
target="_blank" | ||
rel="noopener nofollow noreferrer" | ||
> | ||
<span>Label</span> | ||
</a> | ||
<a href="//google.com" title="Title" target="_blank" data-external="true">Label <svg wire:key="GfLVwv0b" class="fill-current w-4 h-4 inline ml-1 -mt-1.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
<path d="M23.251 7.498V.748h-6.75m6.75 0l-15 15m3-10.5h-9a1.5 1.5 0 00-1.5 1.5v15a1.5 1.5 0 001.5 1.5h15a1.5 1.5 0 001.5-1.5v-9" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path> | ||
</svg> | ||
</a> |
12 changes: 4 additions & 8 deletions
12
...apshots__/LinkRendererTest__it_should_render_external_links_with_(httpsgoogle.com)__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
<a | ||
href="https://google.com" | ||
class="link font-semibold inline space-x-1 whitespace-nowrap" | ||
target="_blank" | ||
rel="noopener nofollow noreferrer" | ||
> | ||
<span>Label</span> | ||
</a> | ||
<a href="https://google.com" title="Title" target="_blank" data-external="true">Label <svg wire:key="GfLVwv0b" class="fill-current w-4 h-4 inline ml-1 -mt-1.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
<path d="M23.251 7.498V.748h-6.75m6.75 0l-15 15m3-10.5h-9a1.5 1.5 0 00-1.5 1.5v15a1.5 1.5 0 001.5 1.5h15a1.5 1.5 0 001.5-1.5v-9" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path> | ||
</svg> | ||
</a> |
12 changes: 4 additions & 8 deletions
12
...__/LinkRendererTest__it_should_render_external_links_with_(unsupportedrelativeurl)__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
<a | ||
href="unsupported/relative/url" | ||
class="link font-semibold inline space-x-1 whitespace-nowrap" | ||
target="_blank" | ||
rel="noopener nofollow noreferrer" | ||
> | ||
<span>Label</span> | ||
</a> | ||
<a href="unsupported/relative/url" title="Title" target="_blank" data-external="true">Label <svg wire:key="GfLVwv0b" class="fill-current w-4 h-4 inline ml-1 -mt-1.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
<path d="M23.251 7.498V.748h-6.75m6.75 0l-15 15m3-10.5h-9a1.5 1.5 0 00-1.5 1.5v15a1.5 1.5 0 001.5 1.5h15a1.5 1.5 0 001.5-1.5v-9" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path> | ||
</svg> | ||
</a> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@props([ | ||
'name', | ||
'size' => 'base', | ||
'style' => '', | ||
'class' => '' | ||
]) | ||
@php | ||
$availableSizes = ['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', 'base']; | ||
if (in_array($size, $availableSizes) || empty($size)) { | ||
$size = [ | ||
'2xs' => 'w-2 h-2 ', | ||
'xs' => 'w-3 h-3 ', | ||
'sm' => 'w-4 h-4 ', | ||
'md' => 'w-6 h-6 ', | ||
'lg' => 'w-8 h-8 ', | ||
'xl' => 'w-12 h-12 ', | ||
'2xl' => 'w-14 h-14 ', | ||
'base' => 'w-5 h-5 ', | ||
][$size ?? 'base']; | ||
} | ||
if (!empty($style)) { | ||
$style = [ | ||
'secondary' => 'text-theme-secondary-500 ', | ||
'success' => 'text-theme-success-500 ', | ||
'danger' => 'text-theme-danger-500 ', | ||
][$style]; | ||
} | ||
@endphp | ||
|
||
<svg wire:key="GfLVwv0b" class="fill-current w-4 h-4 inline ml-1 -mt-1.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
<path d="M23.251 7.498V.748h-6.75m6.75 0l-15 15m3-10.5h-9a1.5 1.5 0 00-1.5 1.5v15a1.5 1.5 0 001.5 1.5h15a1.5 1.5 0 001.5-1.5v-9" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path> | ||
</svg> |