-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Christophe GERARD <[email protected]>
- Loading branch information
Showing
4 changed files
with
78 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script lang="ts"> | ||
import { CURRENCIES } from '$lib/types/Currency'; | ||
import { toCurrency } from '$lib/utils/toCurrency'; | ||
import type { Currency } from '$lib/types/Currency'; | ||
$: firstCurrencyAmount = 1; | ||
$: firstCurrency = 'BTC' as Currency; | ||
$: secondCurrency = 'EUR' as Currency; | ||
$: secondCurrencyAmount = toCurrency(secondCurrency, firstCurrencyAmount, firstCurrency); | ||
</script> | ||
|
||
<div class="flex justify-center mx-auto max-w-3xl bg-gray-800 p-4 rounded-md"> | ||
<div | ||
class="flex items-center bg-gray-900 text-white rounded-md focus-within:ring-2 focus-within:ring-blue-500 m-1" | ||
> | ||
<input | ||
type="number" | ||
class="form-input p-2 bg-transparent text-left text-white focus:outline-none" | ||
bind:value={firstCurrencyAmount} | ||
min="0" | ||
/> | ||
<select | ||
class="p-2 bg-gray-700 text-white border-l border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500" | ||
bind:value={firstCurrency} | ||
> | ||
{#each CURRENCIES as currency} | ||
<option value={currency} selected={currency === firstCurrency}>{currency}</option> | ||
{/each} | ||
</select> | ||
</div> | ||
|
||
<span class="text-gray-400 text-3xl m-1">→</span> | ||
|
||
<div | ||
class="flex items-center bg-gray-900 text-white rounded-md focus-within:ring-2 focus-within:ring-blue-500 m-1" | ||
> | ||
<input | ||
type="text" | ||
class="form-input p-2 bg-transparent text-left text-white focus:outline-none" | ||
bind:value={secondCurrencyAmount} | ||
readonly | ||
/> | ||
<select | ||
class="p-2 bg-gray-700 text-white border-l border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500" | ||
bind:value={secondCurrency} | ||
> | ||
{#each CURRENCIES as currency} | ||
<option value={currency} selected={currency === secondCurrency}>{currency}</option> | ||
{/each} | ||
</select> | ||
</div> | ||
</div> |
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