@@ -2,13 +2,10 @@ import { useState } from "react";
22import { SnippetType } from "../types" ;
33import { useAppContext } from "../contexts/AppContext" ;
44import { useSnippets } from "../hooks/useSnippets" ;
5- import slugify from "../utils/slugify" ;
65
76import Button from "./Button" ;
8- import CodePreview from "./CodePreview" ;
97import SnippetModal from "./SnippetModal" ;
10- import CopyToClipboard from "./CopyToClipboard" ;
11- import { CloseIcon , ExpandIcon } from "./Icons" ;
8+ import { ExpandIcon } from "./Icons" ;
129
1310const SnippetList = ( ) => {
1411 const { language, setSnippet } = useAppContext ( ) ;
@@ -33,9 +30,6 @@ const SnippetList = () => {
3330 < li key = { idx } className = "snippet" >
3431 < div className = "snippet__preview" >
3532 < img src = { language . icon } alt = { language . lang } />
36- { /* <Button isIcon={true} className="snippet__copy">
37- <CopyIcon />
38- </Button> */ }
3933 </ div >
4034
4135 < div className = "snippet__content" >
@@ -45,36 +39,11 @@ const SnippetList = () => {
4539 </ Button >
4640 </ div >
4741 { 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+ />
7847 ) }
7948 </ li >
8049 ) ) }
0 commit comments