@@ -2,13 +2,10 @@ import { useState } from "react";
2
2
import { SnippetType } from "../types" ;
3
3
import { useAppContext } from "../contexts/AppContext" ;
4
4
import { useSnippets } from "../hooks/useSnippets" ;
5
- import slugify from "../utils/slugify" ;
6
5
7
6
import Button from "./Button" ;
8
- import CodePreview from "./CodePreview" ;
9
7
import SnippetModal from "./SnippetModal" ;
10
- import CopyToClipboard from "./CopyToClipboard" ;
11
- import { CloseIcon , ExpandIcon } from "./Icons" ;
8
+ import { ExpandIcon } from "./Icons" ;
12
9
13
10
const SnippetList = ( ) => {
14
11
const { language, setSnippet } = useAppContext ( ) ;
@@ -33,9 +30,6 @@ const SnippetList = () => {
33
30
< li key = { idx } className = "snippet" >
34
31
< div className = "snippet__preview" >
35
32
< img src = { language . icon } alt = { language . lang } />
36
- { /* <Button isIcon={true} className="snippet__copy">
37
- <CopyIcon />
38
- </Button> */ }
39
33
</ div >
40
34
41
35
< div className = "snippet__content" >
@@ -45,36 +39,11 @@ const SnippetList = () => {
45
39
</ Button >
46
40
</ div >
47
41
{ isModalOpen && (
48
- < SnippetModal >
49
- < div className = "modal | flow" data-flow-space = "lg" >
50
- < div className = "modal__header" >
51
- < h2 className = "section-title" > { snippet . title } </ h2 >
52
- < Button isIcon = { true } onClick = { handleCloseModal } >
53
- < CloseIcon />
54
- </ Button >
55
- </ div >
56
- < div className = "code-preview" >
57
- < CopyToClipboard className = "modal__copy" />
58
- < CodePreview language = { slugify ( language . lang ) } >
59
- { snippet . code }
60
- </ CodePreview >
61
- </ div >
62
- < p >
63
- < b > Description: </ b >
64
- { snippet . description }
65
- </ p >
66
- < p >
67
- Contributed by < b > { snippet . author } </ b >
68
- </ p >
69
- < ul role = "list" className = "modal__tags" >
70
- { snippet . tags . map ( ( tag ) => (
71
- < li key = { tag } className = "modal__tag" >
72
- { tag }
73
- </ li >
74
- ) ) }
75
- </ ul >
76
- </ div >
77
- </ SnippetModal >
42
+ < SnippetModal
43
+ snippet = { snippet }
44
+ handleCloseModal = { handleCloseModal }
45
+ language = { language . lang }
46
+ />
78
47
) }
79
48
</ li >
80
49
) ) }
0 commit comments