Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Search Component] - CSS Scoping #2295

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions clients/search-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist/*",
"dist/**/*"
],
"version": "0.0.1-rc5",
"version": "0.0.1-rc6",
"license": "MIT",
"scripts": {
"dev": "run-p watch:css watch:js",
Expand All @@ -25,7 +25,8 @@
"@eslint/js": "^9.9.1",
"@tailwindcss/forms": "^0.5.7",
"@types/eslint__js": "^8.42.3",
"@types/lodash-es": "^4.17.12",
"@types/lodash.omit": "^4.5.9",
"@types/lodash.throttle": "^4.1.9",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@types/react-syntax-highlighter": "^15.5.13",
Expand Down Expand Up @@ -53,7 +54,8 @@
"@radix-ui/react-dialog": "^1.1.1",
"@thumbmarkjs/thumbmarkjs": "^0.14.8",
"downshift": "^9.0.8",
"lodash-es": "^4.17.21",
"lodash.omit": "^4.5.0",
"lodash.throttle": "^4.1.1",
"react-markdown": "^9.0.1",
"react-syntax-highlighter": "^15.5.0",
"trieve-ts-sdk": "*"
Expand Down
2 changes: 1 addition & 1 deletion clients/search-component/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { build } = require("esbuild");
const { dependencies, peerDependencies } = require("../package.json");

const options = {
entryPoints: [`src/index.ts`],
entryPoints: ["src/index.ts"],
bundle: true,
minify: true,
sourcemap: true,
Expand Down
17 changes: 11 additions & 6 deletions clients/search-component/src/TrieveModal/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ body {
}

#trieve-search-modal {
@apply data-[state=open]:animate-contentShow fixed top-[50%] left-[50%] max-h-[80vh] w-[90vw] sm:max-w-[550px] -translate-x-[50%] -translate-y-[50%] rounded-lg bg-zinc-50 p-2 pt-0 shadow-2xl focus:outline-none text-zinc-950;
@apply data-[state=open]:animate-contentShow fixed top-[50%] left-[50%] max-h-[80vh] w-[90vw] sm:max-w-[550px] -translate-x-[50%] -translate-y-[50%] rounded-lg bg-zinc-50 p-2 pt-0 shadow-2xl focus:outline-none text-zinc-950 font-sans;

.trieve-elements-search {
@apply pr-2;
Expand Down Expand Up @@ -67,7 +67,7 @@ body {
h2,
h3,
h4 {
@apply font-semibold pb-2;
@apply font-semibold pb-2 m-0 font-sans leading-normal pt-0 text-base;
}

a {
Expand All @@ -94,7 +94,7 @@ body {
@apply sticky top-0 bg-zinc-50 pt-2 flex items-center z-10 mt-1;

&::after {
@apply absolute h-[17px] w-full z-50 block top-[56px] bg-gradient-to-b from-zinc-50 via-zinc-50 to-transparent dark:from-zinc-900 dark:via-zinc-900 dark:to-transparent;
@apply absolute h-[17px] w-full z-50 block top-[56px] bg-gradient-to-b from-zinc-50 via-zinc-50 to-transparent;
content: "";
}

Expand All @@ -119,7 +119,7 @@ body {
@apply mt-4;

&:not(.chat-ul) {
@apply overflow-auto max-h-[420px] mt-4;
@apply overflow-auto max-h-[420px] mt-4 mx-0 px-0;
}
}

Expand Down Expand Up @@ -165,7 +165,7 @@ body {
}

.description {
@apply font-normal text-xs text-zinc-600;
@apply font-normal text-xs text-zinc-600 m-0;
}
}
&.dark {
Expand All @@ -179,7 +179,7 @@ body {
}

.chat-ul {
@apply border-zinc-700;
@apply border-zinc-700 mb-0;
}

.additional-links {
Expand Down Expand Up @@ -212,6 +212,11 @@ body {

.input-wrapper {
@apply bg-zinc-900;

&::after {
@apply bg-gradient-to-b from-zinc-900 via-zinc-900 to-transparent;
content: "";
}
}

.trieve-powered {
Expand Down
4 changes: 2 additions & 2 deletions clients/search-component/src/TrieveModal/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ export const Item = ({
<p
className="description"
dangerouslySetInnerHTML={{ __html: item.highlights[0] }}
></p>
/>
</div>
) : (
<p
dangerouslySetInnerHTML={{
__html: item.highlights[0] || item.chunk.highlight || "",
}}
></p>
/>
)}
<ArrowIcon />
</div>
Expand Down
2 changes: 1 addition & 1 deletion clients/search-component/src/TrieveSearch/Item.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { omit } from "lodash-es";
import omit from "lodash.omit";
import { Chunk, ChunkWithHighlights } from "../utils/types";
import React from "react";

Expand Down
2 changes: 1 addition & 1 deletion clients/search-component/src/TrieveSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from "react";
import { useCombobox } from "downshift";
import { Item } from "./Item";
import { Chunk, ChunkWithHighlights, Props } from "../utils/types";
import { throttle } from "lodash-es";
import throttle from "lodash.throttle";
import r2wc from "@r2wc/react-to-web-component";
import { searchWithTrieve } from "../utils/trieve";

Expand Down
32 changes: 23 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1288,10 +1288,17 @@
"@types/ace" "*"
ajv "^6.12.0"

"@types/lodash-es@^4.17.12":
version "4.17.12"
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.12.tgz#65f6d1e5f80539aa7cfbfc962de5def0cf4f341b"
integrity sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==
"@types/lodash.omit@^4.5.9":
version "4.5.9"
resolved "https://registry.yarnpkg.com/@types/lodash.omit/-/lodash.omit-4.5.9.tgz#cf4744d034961406d6dc41d9cd109773a9ed8fe3"
integrity sha512-zuAVFLUPJMOzsw6yawshsYGgq2hWUHtsZgeXHZmSFhaQQFC6EQ021uDKHkSjOpNhSvtNSU9165/o3o/Q51GpTw==
dependencies:
"@types/lodash" "*"

"@types/lodash.throttle@^4.1.9":
version "4.1.9"
resolved "https://registry.yarnpkg.com/@types/lodash.throttle/-/lodash.throttle-4.1.9.tgz#f17a6ae084f7c0117bd7df145b379537bc9615c5"
integrity sha512-PCPVfpfueguWZQB7pJQK890F2scYKoDUL3iM522AptHWn7d5NQmeS/LTEHIcLr5PaTzl3dK2Z0xSUHHTHwaL5g==
dependencies:
"@types/lodash" "*"

Expand Down Expand Up @@ -3194,6 +3201,8 @@ eslint-utils@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672"
integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==
dependencies:
eslint-visitor-keys "^2.0.0"

eslint-visitor-keys@^1.1.0:
version "1.3.0"
Expand Down Expand Up @@ -4619,11 +4628,6 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"

lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==

lodash.castarray@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.castarray/-/lodash.castarray-4.4.0.tgz#c02513515e309daddd4c24c60cfddcf5976d9115"
Expand Down Expand Up @@ -4664,11 +4668,21 @@ lodash.merge@^4.6.2:
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

lodash.omit@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.omit/-/lodash.omit-4.5.0.tgz#6eb19ae5a1ee1dd9df0b969e66ce0b7fa30b5e60"
integrity sha512-XeqSp49hNGmlkj2EJlfrQFIzQ6lXdNro9sddtQzcJY8QaoC2GO0DT7xaIokHeyM+mIT0mPMlPvkYzg2xCuHdZg==

lodash.once@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==

lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==

[email protected]:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
Expand Down