matt HOFFNER commited on
Commit
e5b6f72
β€’
1 Parent(s): 2a8011b

markdown stuff

Browse files
package-lock.json CHANGED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -22,6 +22,7 @@
22
  "react-dom": "18.2.0",
23
  "react-icons": "^4.7.1",
24
  "react-markdown": "^8.0.7",
 
25
  "sharp": "^0.32.1"
26
  },
27
  "devDependencies": {
 
22
  "react-dom": "18.2.0",
23
  "react-icons": "^4.7.1",
24
  "react-markdown": "^8.0.7",
25
+ "react-syntax-highlighter": "^15.5.0",
26
  "sharp": "^0.32.1"
27
  },
28
  "devDependencies": {
src/app/search/web/page.jsx CHANGED
@@ -1,6 +1,7 @@
1
  "use client"
2
  import { useEffect, useState } from "react";
3
  import { MemoizedReactMarkdown } from '../../../components/MemoizedReactMarkdown'
 
4
 
5
  export default function WebSearchPage({ searchParams }) {
6
  const [aiResponse, setAiResponse] = useState("");
@@ -48,7 +49,7 @@ export default function WebSearchPage({ searchParams }) {
48
  console.log(aiResponse);
49
 
50
  return (
51
- <div className="flex flex-row">
52
  <MemoizedReactMarkdown
53
  className="prose dark:prose-invert flex-1"
54
  components={{
 
1
  "use client"
2
  import { useEffect, useState } from "react";
3
  import { MemoizedReactMarkdown } from '../../../components/MemoizedReactMarkdown'
4
+ import { CodeBlock } from '../../../components/CodeBlock';
5
 
6
  export default function WebSearchPage({ searchParams }) {
7
  const [aiResponse, setAiResponse] = useState("");
 
49
  console.log(aiResponse);
50
 
51
  return (
52
+ <div style={{ padding: "20px" }} className="flex flex-row">
53
  <MemoizedReactMarkdown
54
  className="prose dark:prose-invert flex-1"
55
  components={{
src/components/CodeBlock.jsx ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { memo } from 'react';
2
+ import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
3
+ import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
4
+
5
+ export const CodeBlock = memo(({ language, value }) => {
6
+
7
+ return (
8
+ <div className="codeblock relative font-sans text-[16px]">
9
+ <SyntaxHighlighter
10
+ language={language}
11
+ style={oneDark}
12
+ customStyle={{ margin: 0 }}
13
+ >
14
+ {value}
15
+ </SyntaxHighlighter>
16
+ </div>
17
+ );
18
+ });
19
+ CodeBlock.displayName = 'CodeBlock';
src/components/SearchHeader.jsx CHANGED
@@ -1,31 +1,12 @@
1
  import Image from "next/image";
2
- import Link from "next/link";
3
  import SearchBox from "./SearchBox";
4
- import { RiSettings3Line } from "react-icons/ri";
5
- import { TbGridDots } from "react-icons/tb";
6
  import SearchHeaderOptions from "./SearchHeaderOptions";
7
 
8
  export default function SearchHeader() {
9
  return (
10
  <header className="sticky top-0 bg-white">
11
  <div className="flex w-full p-6 items-center justify-between">
12
- <Link href={"/"}>
13
- <Image
14
- width="120"
15
- height="40"
16
- src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/640px-Google_2015_logo.svg.png"
17
- />
18
- </Link>
19
- <div className="flex-1">
20
- <SearchBox />
21
- </div>
22
- <div className="hidden md:inline-flex space-x-2 ">
23
- <RiSettings3Line className="header-icon" />
24
- <TbGridDots className="header-icon" />
25
- </div>
26
- <button className="bg-blue-500 text-white px-6 py-2 font-medium rounded-md hover:brightness-105 hover:shadow-md transition-all ml-2">
27
- Sign in
28
- </button>
29
  </div>
30
  <SearchHeaderOptions />
31
  </header>
 
1
  import Image from "next/image";
 
2
  import SearchBox from "./SearchBox";
 
 
3
  import SearchHeaderOptions from "./SearchHeaderOptions";
4
 
5
  export default function SearchHeader() {
6
  return (
7
  <header className="sticky top-0 bg-white">
8
  <div className="flex w-full p-6 items-center justify-between">
9
+ <SearchBox />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  </div>
11
  <SearchHeaderOptions />
12
  </header>