Skip to content

Commit 92e04b6

Browse files
currency app notes
1 parent c886eb2 commit 92e04b6

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

currency.md

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# notes for currency converter app
2+
3+
## api link
4+
5+
```javascript
6+
let url = `https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/${currency}.json`
7+
8+
```
9+
10+
## input box
11+
12+
```javascript
13+
14+
function InputBox({
15+
label,
16+
17+
className = "",
18+
}) {
19+
20+
21+
return (
22+
<div className={`bg-white p-3 rounded-lg text-sm flex `}>
23+
<div className="w-1/2">
24+
<label className="text-black/40 mb-2 inline-block">
25+
label
26+
</label>
27+
<input
28+
29+
className="outline-none w-full bg-transparent py-1.5"
30+
type="number"
31+
placeholder="Amount"
32+
/>
33+
</div>
34+
<div className="w-1/2 flex flex-wrap justify-end text-right">
35+
<p className="text-black/40 mb-2 w-full">Currency Type</p>
36+
<select
37+
className="rounded-lg px-1 py-1 bg-gray-100 cursor-pointer outline-none"
38+
39+
>
40+
41+
<option value=usd>
42+
usd
43+
</option>
44+
45+
</select>
46+
</div>
47+
</div>
48+
);
49+
}
50+
51+
export default InputBox;
52+
53+
```
54+
55+
56+
## app js
57+
58+
```javascript
59+
function App() {
60+
61+
62+
return (
63+
<div
64+
className="w-full h-screen flex flex-wrap justify-center items-center bg-cover bg-no-repeat"
65+
style={{
66+
backgroundImage: `url('${BackgroundImage}')`,
67+
}}
68+
>
69+
<div className="w-full">
70+
<div className="w-full max-w-md mx-auto border border-gray-60 rounded-lg p-5 backdrop-blur-sm bg-white/30">
71+
<form
72+
onSubmit={(e) => {
73+
e.preventDefault();
74+
75+
}}
76+
>
77+
<div className="w-full mb-1">
78+
<InputBox
79+
label="From"
80+
81+
/>
82+
</div>
83+
<div className="relative w-full h-0.5">
84+
<button
85+
type="button"
86+
className="absolute left-1/2 -translate-x-1/2 -translate-y-1/2 border-2 border-white rounded-md bg-blue-600 text-white px-2 py-0.5"
87+
88+
>
89+
swap
90+
</button>
91+
</div>
92+
<div className="w-full mt-1 mb-4">
93+
<InputBox
94+
label="To"
95+
96+
/>
97+
</div>
98+
<button type="submit" className="w-full bg-blue-600 text-white px-4 py-3 rounded-lg">
99+
Convert
100+
</button>
101+
</form>
102+
</div>
103+
</div>
104+
</div>
105+
);
106+
107+
```

0 commit comments

Comments
 (0)