flowbite-svelte 0.24.2 → 0.24.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/buttons/Button.svelte +9 -4
- package/buttons/Button.svelte.d.ts +1 -0
- package/datepicker/Datepicker.svelte +1 -2
- package/forms/FloatingLabelInput.svelte +0 -2
- package/forms/FloatingLabelInput.svelte.d.ts +0 -1
- package/forms/Iconinput.svelte +51 -9
- package/forms/Iconinput.svelte.d.ts +1 -1
- package/forms/Input.svelte +0 -2
- package/forms/Input.svelte.d.ts +0 -1
- package/forms/Textarea.svelte +0 -2
- package/forms/Textarea.svelte.d.ts +0 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -3
- package/paginations/TableData.svelte +1 -1
- package/paginations/TableData.svelte.d.ts +2 -2
- package/ratings/Rating.svelte +19 -12
- package/ratings/Rating.svelte.d.ts +2 -0
- package/ratings/RatingComment.svelte +54 -79
- package/ratings/RatingComment.svelte.d.ts +14 -3
- package/utils/OptsButton.svelte +0 -18
- package/utils/OptsButton.svelte.d.ts +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.24.5](https://github.com/themesberg/flowbite-svelte/compare/v0.24.4...v0.24.5) (2022-08-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add rating count and update app.css ([e5d642b](https://github.com/themesberg/flowbite-svelte/commit/e5d642b4a246c1716db8461e6ecbc26a7abad9d0))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* h3 change, modal page update ([945762f](https://github.com/themesberg/flowbite-svelte/commit/945762f325736ac316a7d1cb68d546f0c8acd982))
|
|
16
|
+
* RatingComment component ([032aa24](https://github.com/themesberg/flowbite-svelte/commit/032aa24925f082459992104d5040804e0d532153))
|
|
17
|
+
* update rating page for AdvancedRating ([f1dc978](https://github.com/themesberg/flowbite-svelte/commit/f1dc978b5775e0089cc6c8aa1fac1c5ed8b97dca))
|
|
18
|
+
|
|
19
|
+
### [0.24.4](https://github.com/themesberg/flowbite-svelte/compare/v0.24.3...v0.24.4) (2022-08-09)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* remove custom from Button component ([6114f4c](https://github.com/themesberg/flowbite-svelte/commit/6114f4c9f5d9ad0848d5e7c000db6c4c9661ad39))
|
|
25
|
+
* remove h-4 w-4 from Iconinput example in the input-field page ([4d5f396](https://github.com/themesberg/flowbite-svelte/commit/4d5f396ea80389b88ec6a8437228d5dbadd46877))
|
|
26
|
+
* update Button component ([330aae9](https://github.com/themesberg/flowbite-svelte/commit/330aae91c6c1b19cbbd1f35177f5e4bac9de3904))
|
|
27
|
+
* update Iconinput ([2b4a7b5](https://github.com/themesberg/flowbite-svelte/commit/2b4a7b55f7db35f3e5b0cc042aa27a84ff741194))
|
|
28
|
+
|
|
29
|
+
### [0.24.3](https://github.com/themesberg/flowbite-svelte/compare/v0.24.2...v0.24.3) (2022-08-09)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* add size to Iconinput component ([f041953](https://github.com/themesberg/flowbite-svelte/commit/f04195350a179d55a7315a127d5b116deaac1f41))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* add rel=external and / to links to form page ([a237d18](https://github.com/themesberg/flowbite-svelte/commit/a237d1811eb1d6d6f3af545f109c71b8cadbd014))
|
|
40
|
+
* breadcrumb and add rel=external to pages in the forms dir. ([509d72a](https://github.com/themesberg/flowbite-svelte/commit/509d72ae703a0d844653da87aea9119a90cc1018))
|
|
41
|
+
* change package.json>engines>node to 16.0.0 since Verce does not accept. But use local node v16.16.0 for playwright test ([08130e9](https://github.com/themesberg/flowbite-svelte/commit/08130e988c1243b6a248737ed604223c694d5981))
|
|
42
|
+
* clean up ref ([9e8427b](https://github.com/themesberg/flowbite-svelte/commit/9e8427bdbe7ee397a8c5c123a75e48abca298781))
|
|
43
|
+
* done type check for all pages ([d91b018](https://github.com/themesberg/flowbite-svelte/commit/d91b018c3a66a6ac4cef2317651e1821083ab033))
|
|
44
|
+
* remove utils/OptsButton ([04ebd83](https://github.com/themesberg/flowbite-svelte/commit/04ebd83aae8a3f3efabac8f3f144b65fabb04da1))
|
|
45
|
+
* Toggle props and typo update ([9a40224](https://github.com/themesberg/flowbite-svelte/commit/9a40224fc26bfefd9d28ec5d364bf4d7430da6f0))
|
|
46
|
+
* type and layout footer padding fix ([999d291](https://github.com/themesberg/flowbite-svelte/commit/999d29158fde736dbf4e19c9545fff6ba41dc7e7))
|
|
47
|
+
* typo ([ec6f019](https://github.com/themesberg/flowbite-svelte/commit/ec6f019501acf4ba2fb105b8cc04a6d347d0dcf1))
|
|
48
|
+
|
|
5
49
|
### [0.24.2](https://github.com/themesberg/flowbite-svelte/compare/v0.24.1...v0.24.2) (2022-08-07)
|
|
6
50
|
|
|
7
51
|
|
package/buttons/Button.svelte
CHANGED
|
@@ -5,6 +5,7 @@ export let outline = false;
|
|
|
5
5
|
export let gradient = false;
|
|
6
6
|
export let size = 'md';
|
|
7
7
|
export let href = undefined;
|
|
8
|
+
export let btnClass = undefined;
|
|
8
9
|
export let color = 'blue';
|
|
9
10
|
export let shadow = null;
|
|
10
11
|
const background = getContext('background');
|
|
@@ -61,10 +62,14 @@ const sizeClasses = {
|
|
|
61
62
|
xl: 'px-6 py-3.5 text-base'
|
|
62
63
|
};
|
|
63
64
|
let buttonClass;
|
|
64
|
-
$: buttonClass =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
$: buttonClass = btnClass
|
|
66
|
+
? btnClass
|
|
67
|
+
: classNames('group text-center font-medium focus:ring-4 focus:outline-none', outline && gradient
|
|
68
|
+
? 'p-0.5'
|
|
69
|
+
: 'inline-flex items-center justify-center ' + sizeClasses[size], gradient ? gradientClasses[color] : outline ? outlineClasses[color] : colorClasses[color], color === 'alternative' &&
|
|
70
|
+
(background
|
|
71
|
+
? 'dark:bg-transparent dark:border-gray-700 dark:hover:border-gray-600'
|
|
72
|
+
: 'dark:bg-transparent dark:border-gray-800 dark:hover:border-gray-700'), pill ? 'rounded-full' : 'rounded-lg', shadow && coloredShadowClasses[shadow], $$props.disabled && 'cursor-not-allowed opacity-50', $$props.class);
|
|
68
73
|
let gradientOutlineClass;
|
|
69
74
|
$: gradientOutlineClass = classNames('inline-flex items-center justify-center', sizeClasses[size], pill ? 'rounded-full' : 'rounded-md', 'bg-white text-gray-900 dark:bg-gray-900 dark:text-white', // this is limitation - no transparency
|
|
70
75
|
'transition-all duration-75 ease-in group-hover:bg-opacity-0 group-hover:text-inherit');
|
|
@@ -7,6 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
gradient?: boolean;
|
|
8
8
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
9
|
href?: string;
|
|
10
|
+
btnClass?: string;
|
|
10
11
|
color?: 'alternative' | 'blue' | 'cyan' | 'dark' | 'light' | 'lime' | 'green' | 'pink' | 'red' | 'teal' | 'yellow' | 'purple' | 'purpleToBlue' | 'cyanToBlue' | 'greenToBlue' | 'purpleToPink' | 'pinkToOrange' | 'tealToLime' | 'redToYellow';
|
|
11
12
|
shadow?: 'blue' | 'green' | 'cyan' | 'teal' | 'lime' | 'red' | 'pink' | 'purple' | null;
|
|
12
13
|
};
|
|
@@ -7,7 +7,6 @@ export let size = 'default';
|
|
|
7
7
|
export let color = 'base';
|
|
8
8
|
export let value = '';
|
|
9
9
|
export let label = '';
|
|
10
|
-
export let ref = null;
|
|
11
10
|
const divClasses = {
|
|
12
11
|
filled: 'relative',
|
|
13
12
|
outlined: 'relative',
|
|
@@ -83,7 +82,6 @@ function setType(node) {
|
|
|
83
82
|
on:mouseleave
|
|
84
83
|
on:mouseover
|
|
85
84
|
on:paste
|
|
86
|
-
bind:this={ref}
|
|
87
85
|
use:setType
|
|
88
86
|
placeholder=" "
|
|
89
87
|
class={classNames(
|
package/forms/Iconinput.svelte
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
export let type = 'text';
|
|
3
3
|
export let value = '';
|
|
4
|
+
export let size = 'md';
|
|
4
5
|
export let icon;
|
|
5
6
|
export let noBorder = false;
|
|
6
|
-
export let inputClass = 'rounded-none rounded-r-lg bg-gray-50 border border-gray-300 text-gray-900 focus:ring-blue-500 focus:border-blue-500 block flex-1 min-w-0 w-full
|
|
7
|
+
export let inputClass = 'rounded-none rounded-r-lg bg-gray-50 border border-gray-300 text-gray-900 focus:ring-blue-500 focus:border-blue-500 block flex-1 min-w-0 w-full border-gray-300 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
|
|
7
8
|
export let spanClass = 'inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 rounded-l-md border border-r-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600';
|
|
8
|
-
export let noBorderInputClass = 'bg-gray-50 border border-gray-300 text-gray-900
|
|
9
|
+
export let noBorderInputClass = 'bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
|
|
9
10
|
export let noBorderDivClass = 'flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none';
|
|
10
|
-
export let iconClass = '
|
|
11
|
-
export let iconSize = 18;
|
|
11
|
+
export let iconClass = 'mr-2';
|
|
12
12
|
function setType(node) {
|
|
13
13
|
node.type = type;
|
|
14
14
|
}
|
|
@@ -16,21 +16,63 @@ function setType(node) {
|
|
|
16
16
|
|
|
17
17
|
{#if noBorder}
|
|
18
18
|
<div class="relative">
|
|
19
|
-
<div
|
|
20
|
-
|
|
19
|
+
<div
|
|
20
|
+
class={classNames(noBorderDivClass, {
|
|
21
|
+
'p-2 sm:text-xs': size === 'sm',
|
|
22
|
+
'p-2.5 text-sm': size === 'md',
|
|
23
|
+
'sm:text-md p-4': size === 'lg'
|
|
24
|
+
})}
|
|
25
|
+
>
|
|
26
|
+
<svelte:component
|
|
27
|
+
this={icon}
|
|
28
|
+
size={classNames({
|
|
29
|
+
16: size === 'sm',
|
|
30
|
+
18: size === 'md',
|
|
31
|
+
20: size === 'lg'
|
|
32
|
+
})}
|
|
33
|
+
class={iconClass}
|
|
34
|
+
/>
|
|
21
35
|
</div>
|
|
22
36
|
<input
|
|
23
37
|
{...$$restProps}
|
|
24
38
|
bind:value
|
|
25
39
|
use:setType
|
|
26
|
-
class={classNames(
|
|
40
|
+
class={classNames(
|
|
41
|
+
noBorderInputClass,
|
|
42
|
+
{
|
|
43
|
+
'p-2 sm:text-xs': size === 'sm',
|
|
44
|
+
'p-2.5 text-sm': size === 'md',
|
|
45
|
+
'sm:text-md p-4': size === 'lg'
|
|
46
|
+
},
|
|
47
|
+
$$props.class
|
|
48
|
+
)}
|
|
27
49
|
/>
|
|
28
50
|
</div>
|
|
29
51
|
{:else}
|
|
30
52
|
<div class="flex">
|
|
31
53
|
<span class={spanClass}>
|
|
32
|
-
<svelte:component
|
|
54
|
+
<svelte:component
|
|
55
|
+
this={icon}
|
|
56
|
+
size={classNames({
|
|
57
|
+
16: size === 'sm',
|
|
58
|
+
18: size === 'md',
|
|
59
|
+
20: size === 'lg'
|
|
60
|
+
})}
|
|
61
|
+
class={iconClass}
|
|
62
|
+
/>
|
|
33
63
|
</span>
|
|
34
|
-
<input
|
|
64
|
+
<input
|
|
65
|
+
{...$$restProps}
|
|
66
|
+
{type}
|
|
67
|
+
class={classNames(
|
|
68
|
+
inputClass,
|
|
69
|
+
{
|
|
70
|
+
'p-2 sm:text-xs': size === 'sm',
|
|
71
|
+
'p-2.5 text-sm': size === 'md',
|
|
72
|
+
'sm:text-md p-4': size === 'lg'
|
|
73
|
+
},
|
|
74
|
+
$$props.class
|
|
75
|
+
)}
|
|
76
|
+
/>
|
|
35
77
|
</div>
|
|
36
78
|
{/if}
|
|
@@ -6,6 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
type?: InputType;
|
|
8
8
|
value?: string;
|
|
9
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
10
|
icon: typeof SvelteComponent;
|
|
10
11
|
noBorder?: boolean;
|
|
11
12
|
inputClass?: string;
|
|
@@ -13,7 +14,6 @@ declare const __propDef: {
|
|
|
13
14
|
noBorderInputClass?: string;
|
|
14
15
|
noBorderDivClass?: string;
|
|
15
16
|
iconClass?: string;
|
|
16
|
-
iconSize?: number;
|
|
17
17
|
};
|
|
18
18
|
events: {
|
|
19
19
|
[evt: string]: CustomEvent<any>;
|
package/forms/Input.svelte
CHANGED
|
@@ -5,7 +5,6 @@ export let value = '';
|
|
|
5
5
|
export let size = 'md';
|
|
6
6
|
export let inputClass = 'block w-full border disabled:cursor-not-allowed disabled:opacity-50 rounded-lg';
|
|
7
7
|
export let color = 'base';
|
|
8
|
-
export let ref = null;
|
|
9
8
|
const colorClasses = {
|
|
10
9
|
base: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500',
|
|
11
10
|
green: 'border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500',
|
|
@@ -22,7 +21,6 @@ function setType(node) {
|
|
|
22
21
|
<input
|
|
23
22
|
{...$$restProps}
|
|
24
23
|
bind:value
|
|
25
|
-
bind:this={ref}
|
|
26
24
|
on:blur
|
|
27
25
|
on:change
|
|
28
26
|
on:click
|
package/forms/Input.svelte.d.ts
CHANGED
package/forms/Textarea.svelte
CHANGED
|
@@ -4,7 +4,6 @@ export let id = generateId();
|
|
|
4
4
|
export let name = 'message';
|
|
5
5
|
export let label = 'Your message';
|
|
6
6
|
export let rows = 4;
|
|
7
|
-
export let ref = null;
|
|
8
7
|
export let placeholder = 'Leave a comment...';
|
|
9
8
|
export let labelClass = 'block mb-2 text-sm font-medium text-gray-900 dark:text-gray-400';
|
|
10
9
|
export let textareaClass = 'block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
|
|
@@ -15,7 +14,6 @@ export let helperClass = 'mt-2 text-sm text-gray-500 dark:text-gray-400';
|
|
|
15
14
|
<label for={id} class={labelClass}>{label}</label>
|
|
16
15
|
<textarea
|
|
17
16
|
bind:value
|
|
18
|
-
bind:this={ref}
|
|
19
17
|
on:blur
|
|
20
18
|
on:change
|
|
21
19
|
on:click
|
package/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export { default as Progressbar } from './progressbars/Progressbar.svelte';
|
|
|
64
64
|
export { default as Rating } from './ratings/Rating.svelte';
|
|
65
65
|
export { default as AdvancedRating } from './ratings/AdvancedRating.svelte';
|
|
66
66
|
export { default as ScoreRating } from './ratings/ScoreRating.svelte';
|
|
67
|
+
export { default as RatingComment } from './ratings/RatingComment.svelte';
|
|
67
68
|
export { default as Sidebar } from './sidebars/Sidebar.svelte';
|
|
68
69
|
export { default as SidebarItem } from './sidebars/SidebarItem.svelte';
|
|
69
70
|
export { default as SidebarBrand } from './sidebars/SidebarBrand.svelte';
|
package/index.js
CHANGED
|
@@ -87,6 +87,7 @@ export { default as Progressbar } from './progressbars/Progressbar.svelte';
|
|
|
87
87
|
export { default as Rating } from './ratings/Rating.svelte';
|
|
88
88
|
export { default as AdvancedRating } from './ratings/AdvancedRating.svelte';
|
|
89
89
|
export { default as ScoreRating } from './ratings/ScoreRating.svelte';
|
|
90
|
+
export { default as RatingComment } from './ratings/RatingComment.svelte';
|
|
90
91
|
// Sidebar
|
|
91
92
|
export { default as Sidebar } from './sidebars/Sidebar.svelte';
|
|
92
93
|
export { default as SidebarItem } from './sidebars/SidebarItem.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.5",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"npm": ">=7.0.0",
|
|
89
|
-
"node": ">=16.
|
|
89
|
+
"node": ">=16.0.0"
|
|
90
90
|
},
|
|
91
91
|
"contributors": [
|
|
92
92
|
"Zoltán Szőgyényi <zoltan@themesberg.com>",
|
|
@@ -218,7 +218,6 @@
|
|
|
218
218
|
"./tooltips/Tooltip.svelte": "./tooltips/Tooltip.svelte",
|
|
219
219
|
"./types": "./types.js",
|
|
220
220
|
"./utils/CloseButton.svelte": "./utils/CloseButton.svelte",
|
|
221
|
-
"./utils/OptsButton.svelte": "./utils/OptsButton.svelte",
|
|
222
221
|
"./utils/clickOutside": "./utils/clickOutside.js",
|
|
223
222
|
"./utils/focusTrap": "./utils/focusTrap.js",
|
|
224
223
|
"./utils/generateId": "./utils/generateId.js"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
-
export let helper;
|
|
2
|
+
export let helper = undefined;
|
|
3
3
|
export let btnPreClass = 'py-2 px-4 text-sm font-medium text-white bg-gray-800 rounded-l hover:bg-gray-900 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white';
|
|
4
4
|
export let btnNextClass = 'py-2 px-4 text-sm font-medium text-white bg-gray-800 rounded-r border-0 border-l border-gray-700 hover:bg-gray-900 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white';
|
|
5
5
|
const dispatch = createEventDispatcher();
|
package/ratings/Rating.svelte
CHANGED
|
@@ -4,22 +4,29 @@ export let total = 5;
|
|
|
4
4
|
export let rating = 4;
|
|
5
5
|
// default is floor
|
|
6
6
|
export let ceil = false;
|
|
7
|
+
export let count = false;
|
|
7
8
|
let roundedRating = ceil ? Math.ceil(rating) : Math.floor(rating);
|
|
8
9
|
let grayStars = total - roundedRating;
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<div class={divClass}>
|
|
12
|
-
{#
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
{#if count}
|
|
14
|
+
<Star variation="solid" size="24" class="text-yellow-300 dark:text-yellow-200" />
|
|
15
|
+
<p class="ml-2 text-sm font-bold text-gray-900 dark:text-white">{rating}</p>
|
|
16
|
+
<slot />
|
|
17
|
+
{:else}
|
|
18
|
+
{#each Array(roundedRating) as _, star}
|
|
19
|
+
<slot name="ratingUp">
|
|
20
|
+
<Star variation="solid" size="24" class="text-yellow-300 dark:text-yellow-200" />
|
|
21
|
+
</slot>
|
|
22
|
+
{/each}
|
|
23
|
+
{#each Array(grayStars) as _, star}
|
|
24
|
+
<slot name="ratingDown">
|
|
25
|
+
<Star size="24" class="text-gray-300 dark:text-gray-500" />
|
|
26
|
+
</slot>
|
|
27
|
+
{/each}
|
|
28
|
+
{#if $$slots.text}
|
|
29
|
+
<slot name="text" />
|
|
30
|
+
{/if}
|
|
24
31
|
{/if}
|
|
25
32
|
</div>
|
|
@@ -1,91 +1,66 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import Button from '../buttons/Button.svelte';
|
|
2
|
+
import { Star } from 'svelte-heros';
|
|
3
|
+
// default is floor
|
|
4
|
+
export let ceil = false;
|
|
5
|
+
export let helpfullink = '';
|
|
6
|
+
export let abuselink = '';
|
|
7
|
+
export let comment;
|
|
8
|
+
let roundedRating = ceil ? Math.ceil(comment.rating) : Math.floor(comment.rating);
|
|
9
|
+
let grayStars = comment.total - roundedRating;
|
|
2
10
|
</script>
|
|
3
11
|
|
|
4
12
|
<article>
|
|
5
13
|
<div class="flex items-center mb-4 space-x-4">
|
|
6
|
-
<img class="w-10 h-10 rounded-full" src={user.img.src} alt={user.img.alt} />
|
|
14
|
+
<img class="w-10 h-10 rounded-full" src={comment.user.img.src} alt={comment.user.img.alt} />
|
|
7
15
|
<div class="space-y-1 font-medium dark:text-white">
|
|
8
|
-
<p>
|
|
16
|
+
<p>
|
|
17
|
+
{comment.user.name}
|
|
18
|
+
<time datetime="2014-08-16 19:00" class="block text-sm text-gray-500 dark:text-gray-400"
|
|
19
|
+
>{comment.user.joined}</time
|
|
20
|
+
>
|
|
21
|
+
</p>
|
|
9
22
|
</div>
|
|
10
23
|
</div>
|
|
11
24
|
<div class="flex items-center mb-1">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
|
|
28
|
-
/></svg
|
|
29
|
-
>
|
|
30
|
-
<svg
|
|
31
|
-
class="w-5 h-5 text-yellow-400"
|
|
32
|
-
fill="currentColor"
|
|
33
|
-
viewBox="0 0 20 20"
|
|
34
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
35
|
-
><path
|
|
36
|
-
d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
|
|
37
|
-
/></svg
|
|
38
|
-
>
|
|
39
|
-
<svg
|
|
40
|
-
class="w-5 h-5 text-yellow-400"
|
|
41
|
-
fill="currentColor"
|
|
42
|
-
viewBox="0 0 20 20"
|
|
43
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
-
><path
|
|
45
|
-
d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
|
|
46
|
-
/></svg
|
|
47
|
-
>
|
|
48
|
-
<svg
|
|
49
|
-
class="w-5 h-5 text-yellow-400"
|
|
50
|
-
fill="currentColor"
|
|
51
|
-
viewBox="0 0 20 20"
|
|
52
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
53
|
-
><path
|
|
54
|
-
d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
|
|
55
|
-
/></svg
|
|
56
|
-
>
|
|
57
|
-
<h3 class="ml-2 text-sm font-semibold text-gray-900 dark:text-white">
|
|
58
|
-
Thinking to buy another one!
|
|
59
|
-
</h3>
|
|
25
|
+
{#each Array(roundedRating) as _, star}
|
|
26
|
+
<slot name="ratingUp">
|
|
27
|
+
<Star variation="solid" size="24" class="text-yellow-300 dark:text-yellow-200" />
|
|
28
|
+
</slot>
|
|
29
|
+
{/each}
|
|
30
|
+
{#each Array(grayStars) as _, star}
|
|
31
|
+
<slot name="ratingDown">
|
|
32
|
+
<Star size="26" class="px-0.5 text-gray-300 dark:text-gray-500" />
|
|
33
|
+
</slot>
|
|
34
|
+
{/each}
|
|
35
|
+
{#if comment.heading}
|
|
36
|
+
<h3 class="ml-2 text-sm font-semibold text-gray-900 dark:text-white">
|
|
37
|
+
{comment.heading}
|
|
38
|
+
</h3>
|
|
39
|
+
{/if}
|
|
60
40
|
</div>
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Invicta and went in the shower with it to test the waterproofing.... No problems.
|
|
68
|
-
</p>
|
|
69
|
-
<p class="mb-3 font-light text-gray-500 dark:text-gray-400">
|
|
70
|
-
It is obviously not the same build quality as those very expensive watches. But that is like
|
|
71
|
-
comparing a Citroën to a Ferrari. This watch was well under £100! An absolute bargain.
|
|
72
|
-
</p>
|
|
73
|
-
<a
|
|
74
|
-
href="/"
|
|
75
|
-
class="block mb-5 text-sm font-medium text-blue-600 hover:underline dark:text-blue-500"
|
|
76
|
-
>Read more</a
|
|
77
|
-
>
|
|
41
|
+
{#if comment.address || comment.datetime}
|
|
42
|
+
<footer class="mb-5 text-sm text-gray-500 dark:text-gray-400">
|
|
43
|
+
<p>Reviewed in {comment.address} on {comment.datetime}</p>
|
|
44
|
+
</footer>
|
|
45
|
+
{/if}
|
|
46
|
+
<slot />
|
|
78
47
|
<aside>
|
|
79
|
-
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
48
|
+
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
|
|
49
|
+
<slot name="evaluation" />
|
|
50
|
+
</p>
|
|
51
|
+
{#if helpfullink || abuselink}
|
|
52
|
+
<div class="flex items-center mt-3 space-x-3 divide-x divide-gray-200 dark:divide-gray-600">
|
|
53
|
+
{#if helpfullink}
|
|
54
|
+
<Button size="xs" href="/" color="dark">Helpful</Button>
|
|
55
|
+
{/if}
|
|
56
|
+
{#if abuselink}
|
|
57
|
+
<a
|
|
58
|
+
href={abuselink}
|
|
59
|
+
class="pl-4 text-sm font-medium text-blue-600 hover:underline dark:text-blue-500"
|
|
60
|
+
>Report abuse</a
|
|
61
|
+
>
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
90
65
|
</aside>
|
|
91
66
|
</article>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
+
ceil?: boolean;
|
|
5
|
+
helpfullink?: string;
|
|
6
|
+
abuselink?: string;
|
|
4
7
|
comment: {
|
|
5
8
|
id: string;
|
|
6
9
|
user: {
|
|
@@ -9,16 +12,24 @@ declare const __propDef: {
|
|
|
9
12
|
src: string;
|
|
10
13
|
alt: string;
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
joined: string;
|
|
13
16
|
};
|
|
17
|
+
total: number;
|
|
14
18
|
rating: number;
|
|
15
|
-
|
|
19
|
+
heading: string;
|
|
20
|
+
address: string;
|
|
21
|
+
datetime: number;
|
|
16
22
|
};
|
|
17
23
|
};
|
|
18
24
|
events: {
|
|
19
25
|
[evt: string]: CustomEvent<any>;
|
|
20
26
|
};
|
|
21
|
-
slots: {
|
|
27
|
+
slots: {
|
|
28
|
+
ratingUp: {};
|
|
29
|
+
ratingDown: {};
|
|
30
|
+
default: {};
|
|
31
|
+
evaluation: {};
|
|
32
|
+
};
|
|
22
33
|
};
|
|
23
34
|
export declare type RatingCommentProps = typeof __propDef.props;
|
|
24
35
|
export declare type RatingCommentEvents = typeof __propDef.events;
|
package/utils/OptsButton.svelte
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import CloseButton from './CloseButton.svelte';
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<CloseButton on:click {...$$props}>
|
|
6
|
-
<span class="sr-only">Open options</span>
|
|
7
|
-
<svg
|
|
8
|
-
class="w-6 h-6"
|
|
9
|
-
aria-hidden="true"
|
|
10
|
-
fill="currentColor"
|
|
11
|
-
viewBox="0 0 20 20"
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
-
>
|
|
14
|
-
<path
|
|
15
|
-
d="M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"
|
|
16
|
-
/>
|
|
17
|
-
</svg>
|
|
18
|
-
</CloseButton>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} OptsButtonProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} OptsButtonEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} OptsButtonSlots */
|
|
4
|
-
export default class OptsButton extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
}, {
|
|
7
|
-
click: MouseEvent;
|
|
8
|
-
} & {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
}, {}> {
|
|
11
|
-
}
|
|
12
|
-
export type OptsButtonProps = typeof __propDef.props;
|
|
13
|
-
export type OptsButtonEvents = typeof __propDef.events;
|
|
14
|
-
export type OptsButtonSlots = typeof __propDef.slots;
|
|
15
|
-
import { SvelteComponentTyped } from "svelte";
|
|
16
|
-
declare const __propDef: {
|
|
17
|
-
props: {
|
|
18
|
-
[x: string]: any;
|
|
19
|
-
};
|
|
20
|
-
events: {
|
|
21
|
-
click: MouseEvent;
|
|
22
|
-
} & {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {};
|
|
26
|
-
};
|
|
27
|
-
export {};
|