File tree Expand file tree Collapse file tree 5 files changed +53
-17
lines changed Expand file tree Collapse file tree 5 files changed +53
-17
lines changed Original file line number Diff line number Diff line change 1+ "use client" 
2+ import  {  useEffect ,  useRef  }  from  "react" 
3+ 
4+ export  const  CARBON_SCRIPT_ID  =  "_carbonads_js" 
5+ const  CARBON_SCRIPT_SRC  = 
6+   "https://cdn.carbonads.com/carbon.js?serve=CW7DTKQ7&placement=react-hook-formcom&format=cover" 
7+ 
8+ export  function  CarbonAds ( {  id } : {  id : string  } )  { 
9+   const  containerRef  =  useRef < HTMLDivElement > ( null ) 
10+ 
11+   useEffect ( ( )  =>  { 
12+     function  injectScript ( )  { 
13+       if  ( document . getElementById ( id ) )  return 
14+ 
15+       const  script  =  document . createElement ( "script" ) 
16+       script . id  =  id 
17+       script . async  =  true 
18+       script . src  =  CARBON_SCRIPT_SRC 
19+       script . type  =  "text/javascript" 
20+ 
21+       if  ( containerRef . current )  { 
22+         containerRef . current . appendChild ( script ) 
23+       } 
24+     } 
25+ 
26+     if  ( document . readyState  ===  "complete" )  { 
27+       injectScript ( ) 
28+     }  else  { 
29+       window . addEventListener ( "load" ,  injectScript ) 
30+ 
31+       return  ( )  =>  window . removeEventListener ( "load" ,  injectScript ) 
32+     } 
33+ 
34+     return 
35+   } ,  [ id ] ) 
36+ 
37+   return  < div  className = "carbonAdsContainer"  ref = { containerRef }  /> 
38+ } 
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import styles from "./SideMenu.module.css"
44import  typographyStyles  from  "../../styles/typography.module.css" 
55import  {  useRouter  }  from  "next/router" 
66import  {  Pages  }  from  "../../types/types" 
7+ import  {  CARBON_SCRIPT_ID ,  CarbonAds  }  from  "@/components/CarbonAds" 
78
89function  Menu ( {  pages =  [ ]  } : {  pages : Pages  } )  { 
910  const  router  =  useRouter ( ) 
@@ -70,8 +71,9 @@ function Menu({ pages = [] }: { pages: Pages }) {
7071            ) 
7172          } ) } 
7273        </ ul > 
73- 
74-         < div  id = "carbon-cover"  /> 
74+         < div  className = { styles . ads } > 
75+           < CarbonAds  id = { CARBON_SCRIPT_ID }  /> 
76+         </ div > 
7577      </ div > 
7678    </ aside > 
7779  ) 
Original file line number Diff line number Diff line change 3838    max-width :  230px  ;
3939    padding :  0 ;
4040    overflow-y :  auto;
41-     height :  calc (100vh   -  190 px 
41+     height :  calc (100vh   -  600 px 
4242    overflow-y :  auto;
4343  }
4444
4949    display :  flex;
5050  }
5151
52+   .menu  >  div  >  ul  >  li : last-child  {
53+     padding-bottom :  0 ;
54+   }
55+ 
5256  .menu  >  div  >  ul  >  li  >  a  {
5357    text-decoration :  none;
5458    padding-left :  6px  ;
118122  .menu  >  div  >  ul  {
119123    margin-top :  0 ;
120124    max-width :  260px  ;
125+     height :  calc (100vh   -  450px  );
121126  }
122127
123128  .menu  >  ul  {
204209.menu  ul  li  a .isActive  {
205210  border-bottom :  1px   solid var (--color-secondary );
206211}
212+ 
213+ .ads  {
214+   position :  absolute;
215+   height :  500px  ;
216+ }
Original file line number Diff line number Diff line change @@ -945,11 +945,3 @@ pre[class*="language-"] {
945945    height :  auto;
946946  }
947947}
948- 
949- # carbon-responsive  {
950-   margin :  0  auto 50px  ;
951- }
952- 
953- # carbon-cover  {
954-   margin :  0  auto 50px  ;
955- }
Original file line number Diff line number Diff line change @@ -13,12 +13,6 @@ export default function Document() {
1313          strategy = "afterInteractive" 
1414          src = "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js" 
1515        /> 
16-         < Script 
17-           async 
18-           strategy = "afterInteractive" 
19-           src = "https://cdn.carbonads.com/carbon.js?serve=CW7DTKQ7& placement = react - hook - formcom & format = cover " 
20-           id = "_carbonads_js" 
21-         /> 
2216        < link 
2317          rel = "shortcut icon" 
2418          href = "/images/logo/react-hook-form-logo-only.png" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments