Skip to content

Commit

Permalink
refactor: replace Input with FormControl wherever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal committed Sep 4, 2023
1 parent 21f0384 commit 3c93a8f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/ExpenseAdvancesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
>
<div class="flex flex-row justify-between items-center">
<div class="flex flex-row items-start gap-3">
<Input
<FormControl
type="checkbox"
class="mt-[0.5px]"
v-model="advance.selected"
Expand All @@ -42,7 +42,7 @@
<span class="text-normal">
{{ currency }}
</span>
<Input
<FormControl
type="number"
class="w-20"
v-model="advance.allocated_amount"
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/>

<!-- Text -->
<Input
<FormControl
v-else-if="
['Text Editor', 'Small Text', 'Text', 'Long Text'].includes(
props.fieldtype
Expand All @@ -42,7 +42,7 @@
/>

<!-- Check -->
<Input
<FormControl
v-else-if="props.fieldtype === 'Check'"
type="checkbox"
:label="props.label"
Expand All @@ -54,7 +54,7 @@
/>

<!-- Data field -->
<Input
<FormControl
v-else-if="props.fieldtype === 'Data'"
type="text"
:value="modelValue"
Expand All @@ -65,7 +65,7 @@
/>

<!-- Read only currency field -->
<Input
<FormControl
v-else-if="props.fieldtype === 'Currency' && isReadOnly"
type="text"
:value="modelValue"
Expand All @@ -76,7 +76,7 @@
/>

<!-- Float/Int field -->
<Input
<FormControl
v-else-if="isNumberType"
type="number"
:value="modelValue"
Expand All @@ -99,7 +99,7 @@

<!-- Date -->
<!-- FIXME: default datepicker has poor UI -->
<Input
<FormControl
v-else-if="props.fieldtype === 'Date'"
type="date"
v-model="date"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/FormattedField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{ dayjs(props.value).format("D MMM") }}
</div>

<Input
<FormControl
v-else-if="props.fieldtype === 'Check'"
type="checkbox"
label=""
Expand All @@ -35,7 +35,7 @@

<script setup>
import { inject } from "vue"
import { Badge, Input } from "frappe-ui"
import { Badge, FormControl, Input } from "frappe-ui"
import EmployeeAvatar from "@/components/EmployeeAvatar.vue"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import socket from "./socket"
import {
Button,
Input,
FormControl,
setConfig,
frappeRequest,
resourcesPlugin,
Expand Down Expand Up @@ -34,6 +35,7 @@ app.use(resourcesPlugin)

app.component("Button", Button)
app.component("Input", Input)
app.component("FormControl", FormControl)
app.component("EmptyState", EmptyState)

app.use(router)
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</div>
<div class="mx-auto mt-6 w-full px-8 sm:w-96">
<form class="flex flex-col space-y-4" @submit.prevent="submit">
<Input
<FormControl
label="Email"
placeholder="[email protected]"
v-model="email"
:type="email !== 'Administrator' ? 'email' : 'text'"
/>
<Input
<FormControl
label="Password"
type="password"
placeholder="••••••"
Expand All @@ -32,7 +32,7 @@
<script setup>
import { IonPage, IonContent } from "@ionic/vue"
import { inject, ref } from "vue"
import { Input, Button } from "frappe-ui"
import { Button, FormControl } from "frappe-ui"
const email = ref(null)
const password = ref(null)
Expand Down

0 comments on commit 3c93a8f

Please sign in to comment.