Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
    <script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
</head>

<body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>

</body>
              
            
!

CSS

              
                .quoteBoxStyle {
  border-radius: 12px;
  background: #e0e0e0;
  box-shadow: 20px 20px 60px #bebebe, -20px -20px 60px #ffffff;
}

.3xl {
    20px 20px 60px #bebebe, -20px -20px 60px #ffffff;
}

              
            
!

JS

              
                import React from "https://cdn.skypack.dev/react@17.0.1";
import ReactDOM from "https://cdn.skypack.dev/react-dom@17.0.1";
import { useState } from "https://cdn.skypack.dev/react@17.0.1";
// import * as reactIcons from "https://cdn.skypack.dev/react-icons@4.2.0";
import { FaQuoteLeft, FaTwitter } from "https://cdn.skypack.dev/react-icons/fa";

const data = [
    {
        text:
            "The best lesson I ever had was when I approached a senior developer with a big problem I was faced with and he said 'I have no idea.' and began Googling it.",
        author: "Danny Thompson",
        shadow: "20px 20px 60px #bebebe, -20px -20px 60px #ffffff",
        backgroundColor: {
            backgroundColor: "#e0e0e0"
        },
        shadowBtn: "5px 5px 10px #bebebe,-5px -5px 10px #ffffff"
    },
    {
        text:
            "Difference between a senior developer and junior developer: 'One is faster at googling StackOverflow solutions.'",
        author: "Faruk Brbovic",
        shadow: "20px 20px 60px #2bba81,-20px -20px 60px #3afcaf",
        backgroundColor: {
            backgroundColor: "rgb(167, 243, 208)"
        },
        shadowBtn: "5px 5px 10px #2bba81,-5px -5px 10px #3afcaf"
    },
    {
        text:
            "The more time you spend with someone, the more habits you pick up from them. So spend time with people you admire and want to be like, and actively avoid those who bring you down.",
        author: "Madison Kanna",
        shadow: "15px 15px 30px #c86094, -15px -15px 30px #ff82c8",
        backgroundColor: {
            backgroundColor: "#EB71AE"
        },
        shadowBtn: "5px 5px 10px #c86094,-5px -5px 10px #ff82c8"
    },
    {
        text:
            "Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails.",
        author: "Mark Twain",
        shadow: " 20px 20px 60px #b86505, -20px -20px 60px #fa8907",
        backgroundColor: {
            backgroundColor: "#D97706"
        },
        shadowBtn: "5px 5px 10px #b86505,-5px -5px 10px #fa8907"
    },
    {
        text:
            "The most difficult thing is the decision to act. The rest is merely tenacity.",
        author: "Amelia Earhart",
        shadow: "20px 20px 60px #6931c9, -20px -20px 60px #8f43ff",
        backgroundColor: {
            backgroundColor: "#7C3AED"
        },
        shadowBtn: "5px 5px 10px #6931c9,-5px -5px 10px #8f43ff"
    }
];

function App() {
    const [quotes, setQuotes] = useState(data);

    const [index, setIndex] = useState(0);
    const [wrapper, setWrapper] = useState(
        "min-h-screen flex justify-center items-center antialiased selection:bg-gray-900 selection:text-white"
    );
    const [quoteBox, setQuoteBox] = useState("w-11/12 max-w-3xl");
    const hundleChange = () => {
        setIndex((prev) => {
            let sum = prev + 1;
            if (sum >= quotes.length) {
                sum = 0;
                return sum;
            }
            return sum;
        });
    };
    const boxStyle = {
        boxShadow: quotes[index].shadow
    };
    const shadowBtn = {
        boxShadow: quotes[index].shadowBtn
    };

    return (
        <div
            style={quotes[index].backgroundColor}
            className={wrapper}
            id="wrapper"
        >
            <div className={quoteBox} id="quote-box">
                <div
                    style={boxStyle}
                    className="flex p-4 space-x-2 text-lg font-bold text-gray-900 rounded-lg sm:text-xl md:text-3xl md:p-12"
                    id="text"
                >
                    <span>
                        <FaQuoteLeft className="text-3xl sm:text-4xl" />
                    </span>

                    <p>{quotes[index].text}</p>
                </div>
                <div className="flex justify-between mt-8 font-medium text-gray-900">
                    <div
                        style={shadowBtn}
                        className="flex items-center px-4 py-2 space-x-1 rounded hover:!shadow  transition-shadow duration-1000 ease-out"
                    >
                        <a
                            href="https://twitter.com/intent/tweet"
                            target="_blank"
                            id="tweet-quote"
                            rel="noreferrer"
                            className=""
                        >
                            Tweet
                        </a>
                        <span>
                            <FaTwitter />
                        </span>
                    </div>

                    <p
                        id="author"
                        style={shadowBtn}
                        className="px-4 py-2 rounded hover:!shadow  transition-shadow duration-1000 ease-out"
                    >
                        - {quotes[index].author}
                    </p>
                </div>
                <div className="flex justify-center mt-6 text-gray-900">
                    <button
                        id="new-quote"
                        style={shadowBtn}
                        onClick={() => hundleChange()}
                        className="p-3 mx-auto text-xl font-semibold rounded-md focus:outline-none hover:!shadow  transition-shadow duration-1000 ease-out"
                    >
                        New Quote
                    </button>
                </div>
            </div>
        </div>
    );
}

ReactDOM.render(<App />, document.getElementById("root"));

              
            
!
999px

Console