mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-27 15:22:56 +08:00
add ads close button
This commit is contained in:
parent
81401b042e
commit
3743e0aac7
@ -1,8 +1,26 @@
|
|||||||
import Script from "next/script";
|
import Script from "next/script";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { IoMdClose } from "react-icons/io";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
const StyledCloseBtn = styled.button`
|
||||||
|
display: none;
|
||||||
|
width: 3vw;
|
||||||
|
height: 3vw;
|
||||||
|
opacity: 0.8;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 50;
|
||||||
|
border-radius: 0;
|
||||||
|
background: ${({ theme }) => theme.DANGER};
|
||||||
|
`;
|
||||||
|
|
||||||
const StyledWrapper = styled.span<{ editor?: boolean }>`
|
const StyledWrapper = styled.span<{ editor?: boolean }>`
|
||||||
|
position: relative;
|
||||||
|
|
||||||
#carbonads {
|
#carbonads {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -22,6 +40,12 @@ const StyledWrapper = styled.span<{ editor?: boolean }>`
|
|||||||
}
|
}
|
||||||
`};
|
`};
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
${StyledCloseBtn} {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media all and (display-mode: standalone) {
|
@media all and (display-mode: standalone) {
|
||||||
#carbonads {
|
#carbonads {
|
||||||
display: none;
|
display: none;
|
||||||
@ -32,8 +56,15 @@ const StyledWrapper = styled.span<{ editor?: boolean }>`
|
|||||||
export const CarbonAds: React.FC<{ editor?: boolean }> = ({
|
export const CarbonAds: React.FC<{ editor?: boolean }> = ({
|
||||||
editor = false,
|
editor = false,
|
||||||
}) => {
|
}) => {
|
||||||
|
const [isHidden, setIsHidden] = React.useState(false);
|
||||||
|
|
||||||
|
if (isHidden) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper editor={editor} id="carbon-wrapper">
|
<StyledWrapper editor={editor} id="carbon-wrapper">
|
||||||
|
<StyledCloseBtn onClick={() => setIsHidden(true)}>
|
||||||
|
<IoMdClose color="white" size="15" />
|
||||||
|
</StyledCloseBtn>
|
||||||
<Script
|
<Script
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="https://cdn.carbonads.com/carbon.js?serve=CE7IPKQL&placement=jsonvisiocom"
|
src="https://cdn.carbonads.com/carbon.js?serve=CE7IPKQL&placement=jsonvisiocom"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user