Skip to content

Commit 1010058

Browse files
committed
Updated documentation for currency component, clarified usage guidance and presentation
1 parent e965189 commit 1010058

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

resources/views/documentation/v2/form/currency.blade.php

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<x-section title="Concept" disable-copy>
1616
The currency component is a component designed for displaying and formatting
1717
currency values. Behind the scenes the currency component is an adaptation of
18-
the Input component with usage of native JavaScript's <x-block>Intl.NumberFormat</x-block>
18+
the <x-block>input</x-block> component with usage of native JavaScript's <x-block>Intl.NumberFormat</x-block>
1919
</x-section>
2020
<x-section title="Basic Usage">
2121
<x-preview language="blade" :contents="$basic">
@@ -35,7 +35,7 @@
3535
<x-section title="Different Currencies">
3636
<div class="space-y-4">
3737
<p>
38-
The currency component has a <x-block>locale</x-block> attribute that matches the logic of
38+
You should use the <x-block>locale</x-block> attribute to matches the logic of
3939
<x-block>Intl.NumberFormat</x-block>. By default, the value assigned to the locale attribute
4040
is <x-block>en-US</x-block>, but you can use any other value supported by <x-block>Intl.NumberFormat</x-block>
4141
to format the input in the desired currency format.
@@ -52,7 +52,7 @@
5252
<x-section title="Intl Options" disable-copy>
5353
<div class="space-y-4">
5454
<p>
55-
The currency component was built with two attributes that are intended to manipulate the JavaScript <x-block>Intl.NumberFormat</x-block>,
55+
The component was built with two attributes that are intended to manipulate the JavaScript <x-block>Intl.NumberFormat</x-block>,
5656
called <x-block>decimals</x-block> and <x-block>precision</x-block>. You can use them to manipulate the
5757
JavaScript <x-block>Intl.NumberFormat</x-block>:
5858
</p>
@@ -62,7 +62,7 @@
6262
<x-section title="Symbols">
6363
<div class="space-y-4">
6464
<p>
65-
The currency component supports displaying symbols related to each supported
65+
You can display symbols related to each supported
6666
currency through <a href="{{ route('documentation', ['v2', 'translation']) }}" class="underline">TallStackUI's translation system.</a> You can control which symbol
6767
will be displayed via arguments.
6868
</p>
@@ -89,15 +89,22 @@
8989
<x-section title="Caveats">
9090
<div class="space-y-4">
9191
<p>
92-
There are a few important things to note about the currency component. The first is that the component
93-
can be used entirely out of the Livewire context. For this type of situation, the value to be formatted
94-
should be sent to the currency component using the <x-block>value</x-block> attribute, but with the value as a string.
95-
The value will be returned to the controller formatted as a string, when the form is submitted.
96-
When the component is used inside the Livewire context, however, the value can be sent in different
97-
formats <i>(float, int, string)</i>, but the value returned by default will not be formatted. To format the
98-
value when emitting it to the Livewire, you must use the <x-block>mutate</x-block> attribute, which
99-
instructs the currency component to format the value before binding it to the Livewire property.
92+
There are a few important caveats to note about the currency component:
10093
</p>
94+
<ul class="list-inside list-decimal space-y-2">
95+
<li>
96+
The component
97+
can be used entirely out of the Livewire context. For this type of situation, the value to be formatted
98+
should be sent to the currency component using the <x-block>value</x-block> attribute, but with the value as a string.
99+
The value will be returned to the controller formatted as a string, when the form is submitted.
100+
</li>
101+
<li>
102+
When using the component inside the Livewire context, however, the value can be sent to the component in different
103+
formats <i>(float, int, string)</i>, but the value returned by default will not be formatted. To format the
104+
value when emitting it to the Livewire, you must use the <x-block>mutate</x-block> attribute, which
105+
instructs the currency component to format the value before binding it to the Livewire property.
106+
</li>
107+
</ul>
101108
<x-preview language="blade" :contents="$mutate">
102109
<div class="space-y-2">
103110
<livewire:documentation.form.currency />

resources/views/livewire/documentation/form/currency.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<div>
88
<div class="space-y-2">
99
<x-currency label="Mutating" wire:model.live="value" mutate />
10-
<x-badge>Value: {{ $value }}</x-badge>
10+
<x-badge>Value Binded: {{ $value }}</x-badge>
1111
</div>
1212
</div>

0 commit comments

Comments
 (0)