Skip to content

Commit 98b89a9

Browse files
authored
fix: remove mock count in status card and make unit changeable in data page (#148)
* fix: remove text from all bill status cards and change text in Bill Explore Page * fix: improve unit prop
1 parent c3dcc68 commit 98b89a9

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

src/components/DataPage/DataPage.story.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ export type SelectedComboboxValueType = Record<
5656
| `filteredData` | `{ id: any; [key: string]: any }[]` | ข้อมูลใส่ตารางที่ผ่านการ filter มาจากด้านนอกแล้ว |
5757
| `tableHeader` | `{ key: string; value: string }[]` | ข้อมูลหัวตาราง |
5858
| `tablePageSize` | `number = 10` | จำนวนข้อมูลต่อหน้า |
59+
| `unit` | `string = 'มติ หรือ คำที่เกี่ยวข้อง'` | คำที่แสดงในส่วนท้ายของ DataPage component |
5960

6061
## Reactive Props
6162

6263
Props เหล่านี้ต้อง `bind:props` เพื่อให้ parent component สามารถทราบ state ด้านใน component ได้
6364

64-
| Props | Type | Meaning |
65-
| ---------------------------- | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
66-
| `bind:searchQuery` | `string = ""` | ข้อความในกล่องค้นหา |
67-
| `bind:selectedComboboxValue` | `SelectedComboboxValueType = ทุกช่องเป็น undefined*` | เป็น Object ที่จะมี key เป็น key ของ combobox นั้น และ value เป็น value ของ combobox นั้นๆ |
65+
| Props | Type | Meaning |
66+
| ---------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
67+
| `bind:searchQuery` | `string = ""` | ข้อความในกล่องค้นหา |
68+
| `bind:selectedComboboxValue` | `SelectedComboboxValueType = ทุกช่องเป็น undefined*` | เป็น Object ที่จะมี key เป็น key ของ combobox นั้น และ value เป็น value ของ combobox นั้นๆ |
6869
| `bind:selectedCheckboxValue` | `SelectedCheckboxValueType = ทุกชอยส์**` | เป็น Object ที่จะมี key เป็น key ของ checkbox กลุ่มนั้น และ value เป็น array ของ choice ของกลุ่ม checkbox นั้นๆ |
69-
| `bind:mounted` | `boolean = false` | เอาไว้ sync กับด้านนอกว่าตอนนี้ DataPage mount แล้วหรือยัง |
70+
| `bind:mounted` | `boolean = false` | เอาไว้ sync กับด้านนอกว่าตอนนี้ DataPage mount แล้วหรือยัง |
7071

7172
> - \*ทุกช่องเป็น undefined = `Object.fromEntries(comboboxFilterList.map((group) => [group.key, undefined]));`
7273
> - \*ทุกชอยส์ = `Object.fromEntries(checkboxFilterList.map((group) => [group.key, group.choices.map((choice) => choice.value)]));`

src/components/DataPage/DataPage.story.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@
7373
? e.type === selectedComboboxValue.filterComboboxType
7474
: true)
7575
);
76+
let unit = 'มติ';
7677
</script>
7778

7879
<Hst.Story title="DataPage" layout={{ type: 'single', iframe: true }}>
7980
<div class="body-02 bg-white font-sans">
8081
<DataPage
82+
{unit}
8183
{breadcrumbList}
8284
{searchPlaceholder}
8385
{comboboxFilterList}
@@ -115,6 +117,7 @@
115117
<Hst.Number bind:value={tablePageSize} title="(Prop) Table Page Size" />
116118
<hr />
117119
<Hst.Text bind:value={searchQuery} title="(Reactive) Search Query" />
120+
<Hst.Text bind:value={unit} title="(Prop) unit" />
118121
<section class="mb-2 border border-solid border-white p-2">
119122
<strong class="mb-2 block">Selected Filter?</strong>
120123
<pre class="border border-solid border-gray-50 p-2"><code

src/components/DataPage/DataPage.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@
4343
Checkbox,
4444
ComboBox,
4545
DataTable,
46-
DataTableSkeleton,
4746
FormGroup,
4847
Pagination,
49-
PaginationSkeleton,
5048
Search
5149
} from 'carbon-components-svelte';
5250
import Filter from 'carbon-icons-svelte/lib/Filter.svelte';
@@ -145,6 +143,8 @@
145143
renderCombobox = true;
146144
});
147145
};
146+
147+
export let unit = 'มติ';
148148
</script>
149149

150150
<svelte:window on:scroll|passive={scrollEventHandler} />
@@ -313,7 +313,7 @@
313313
pageSizeInputDisabled
314314
forwardText="หน้าถัดไป"
315315
backwardText="หน้าก่อนหน้า"
316-
itemRangeText={(min, max, total) => `${min} - ${max} จาก ${total} มติ`}
316+
itemRangeText={(min, max, total) => `${min} - ${max} จาก ${total} ${unit}`}
317317
pageRangeText={(_, total) => `จาก ${total} หน้า`}
318318
/>
319319
</div>

src/components/LegislativeProcess/BillStatusCard.svelte

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import BillStatusTag from '../BillStatusTag/BillStatusTag.svelte';
55
66
export let billStatus: BillStatus;
7-
export let billAmount: string;
7+
// export let billAmount: string;
88
export let descriptionTitle: string | null;
99
export let descriptionList: Array<string>;
1010
export let learnMoreLabel: string;
@@ -26,13 +26,7 @@
2626
isLarge={true}
2727
status={billStatus}
2828
/>
29-
<div
30-
class="my-2 text-sm font-semibold
31-
"
32-
>
33-
จำนวน {billAmount} ฉบับ
34-
</div>
35-
<div class="text-sm font-normal">
29+
<div class="mt-2 text-sm font-normal">
3630
{descriptionTitle}
3731
<ul class="px-4">
3832
{#each descriptionList as list}

src/routes/bills/explore/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149

150150
<DataPage
151151
bind:this={cmpDataPage}
152+
unit="ร่างกฎหมาย"
152153
tablePageSize={50}
153154
breadcrumbList={[
154155
{ url: '/', label: 'หน้าหลัก' },

0 commit comments

Comments
 (0)