Skip to content

Commit 5d7bbfd

Browse files
authored
Merge pull request #501 from performant-software/feature/cdp220_saved_search_results
CDP #220 - Saved search results
2 parents ed4de73 + 63306a5 commit 5d7bbfd

File tree

8 files changed

+516
-148
lines changed

8 files changed

+516
-148
lines changed

packages/core-data/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"build": "vite build && flow-copy-source -v src types"
2424
},
2525
"dependencies": {
26+
"@headlessui/react": "^2.2.4",
2627
"@radix-ui/react-accordion": "^1.1.2",
2728
"@radix-ui/react-checkbox": "^1.0.4",
2829
"@radix-ui/react-dialog": "^1.1.1",

packages/core-data/src/components/FacetTimeline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const FacetTimeline = (props: Props) => {
229229
]}
230230
classNames={{
231231
...props.classNames,
232-
range: clsx('cursor-grab', 'active:cursor-grabbing', 'bg-primary-500', 'border', 'border-black', props.classNames?.range),
232+
range: clsx('cursor-grab', 'active:cursor-grabbing', 'bg-primary', 'border', 'border-black', props.classNames?.range),
233233
root: clsx('ml-14', 'mr-5', props.classNames?.root),
234234
track: clsx('cursor-grab', 'active:cursor-grabbing', 'h-5', 'mb-4', props.classNames?.track),
235235
thumb: clsx('opacity-0', 'w-[1px]', props.classNames?.thumb),

packages/core-data/src/components/Icon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import ZoomOutIcon from '../icons/ZoomOutIcon';
3232
type Props = {
3333
className?: string,
3434
name: string,
35-
size: number,
35+
size?: number,
3636
style?: any
3737
};
3838

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// @flow
2+
3+
import { Transition } from '@headlessui/react';
4+
import React, { useEffect } from 'react';
5+
import _ from 'underscore';
6+
import Icon from './Icon';
7+
8+
type Props = {
9+
content: string,
10+
header: string,
11+
icon?: {
12+
className?: string,
13+
name: string,
14+
size?: number
15+
},
16+
onClose: () => void,
17+
open?: boolean,
18+
timeout?: number
19+
};
20+
21+
const Notification = (props: Props) => {
22+
/**
23+
* If a `timeout` prop is provided, call the `onClose` callback after the specified interval.
24+
*/
25+
useEffect(() => {
26+
if (props.open && props.timeout) {
27+
_.delay(props.onClose, props.timeout);
28+
}
29+
}, [props.open, props.timeout]);
30+
31+
return (
32+
<div
33+
aria-live='assertive'
34+
className='pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-10'
35+
>
36+
<div
37+
className='flex w-full flex-col items-center space-y-4 sm:items-end'
38+
>
39+
<Transition
40+
show={props.open}
41+
>
42+
<div
43+
className={`
44+
pointer-events-auto
45+
w-full
46+
max-w-sm
47+
overflow-hidden
48+
rounded-lg
49+
bg-white
50+
shadow-lg
51+
ring-1
52+
ring-black/5
53+
transition
54+
data-closed:opacity-0
55+
data-enter:transform
56+
data-enter:duration-300
57+
data-enter:ease-out
58+
data-closed:data-enter:translate-y-2
59+
data-leave:duration-100
60+
data-leave:ease-in
61+
data-closed:data-enter:sm:translate-x-2
62+
data-closed:data-enter:sm:translate-y-0
63+
`}
64+
>
65+
<div
66+
className='p-4'
67+
>
68+
<div
69+
className='flex items-start'
70+
>
71+
<div
72+
className='shrink-0'
73+
>
74+
{ props.icon && (
75+
<Icon
76+
className={props.icon.className}
77+
name={props.icon.name}
78+
size={props.icon.size}
79+
/>
80+
)}
81+
</div>
82+
<div
83+
className='ml-3 w-0 flex-1 pt-0.5'
84+
>
85+
<p
86+
className='text-sm font-medium text-gray-900'
87+
>
88+
{ props.header }
89+
</p>
90+
<p
91+
className='mt-1 text-sm text-gray-500'
92+
>
93+
{ props.content }
94+
</p>
95+
</div>
96+
<div
97+
className='ml-4 flex shrink-0'
98+
>
99+
<button
100+
className={`
101+
inline-flex
102+
rounded-md
103+
bg-white
104+
text-gray-400
105+
hover:text-gray-500
106+
focus:ring-2
107+
focus:ring-indigo-500
108+
focus:ring-offset-2
109+
focus:outline-hidden
110+
`}
111+
onClick={props.onClose}
112+
type='button'
113+
>
114+
<span
115+
className='sr-only'
116+
>
117+
Close
118+
</span>
119+
<Icon
120+
name='close'
121+
/>
122+
</button>
123+
</div>
124+
</div>
125+
</div>
126+
</div>
127+
</Transition>
128+
</div>
129+
</div>
130+
);
131+
};
132+
133+
export default Notification;

0 commit comments

Comments
 (0)