MCPcopy Create free account
hub / github.com/47ng/nuqs / Querystring

Function Querystring

packages/docs/src/components/querystring.tsx:10–43  ·  view source on GitHub ↗
({
  path,
  value,
  keepKeys,
  ...props
}: QuerystringProps)

Source from the content-addressed store, hash-verified

8}
9
10export function Querystring({
11 path,
12 value,
13 keepKeys,
14 ...props
15}: QuerystringProps) {
16 const search = useMemo(
17 () => filterQueryKeys(value, keepKeys),
18 [value, keepKeys]
19 )
20 return (
21 <QuerystringSkeleton {...props}>
22 {path && <span className="text-zinc-500">{path}</span>}
23 {Array.from(search.entries()).map(([key, value], i) => (
24 <Fragment key={key + i}>
25 <span className="text-zinc-500">
26 {i === 0 ? (
27 '?'
28 ) : (
29 <>
30 <wbr />&
31 </>
32 )}
33 </span>
34 <span className="text-[#005CC5] dark:text-[#79B8FF]">{key}</span>=
35 <span className="text-[#D73A49] dark:text-[#F97583]">{value}</span>
36 </Fragment>
37 ))}
38 {search.size === 0 && (
39 <span className="text-zinc-500 italic">{'<empty query>'}</span>
40 )}
41 </QuerystringSkeleton>
42 )
43}
44
45export function QuerystringSkeleton({
46 children,

Callers

nothing calls this directly

Calls 1

filterQueryKeysFunction · 0.85

Tested by

no test coverage detected