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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <div id="root">
  <div>

    <!--  

inspiration....
https://muzzleapp.com/

-->
              
            
!

CSS

              
                html,
body {
  height: 100vh;
  width: 100%;
  min-width: 400px;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  background-color: grey;
}

.notification-container {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  top: 15px;
  width: 350px;
  height: 40px;
  border-radius: 20px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.16), 0 3px 16px rgba(0, 0, 0, 0.23);
  color: rgba(0, 0, 0, 0.8);
  font-size: 16px;
  padding: 15px 20px;
  line-height: 20px;
  margin-bottom: 15px;
  animation: slideIn 1s ease-in-out forwards;
}

.notification-container:hover {
  cursor: pointer;
}

.notification-icon-container {
  width: 40px;
  margin-left: -10px;
}

.notification-icon {
  width: 35px;
  border-radius: 50%;
  margin-top: 2px;
}

.notification-header {
  font-size: 15px;
  font-weight: 500;
}

.notification-text {
  font-size: 12px;
  color: #656f73;
}

.notification-data {
  margin-left: 10px;
  width: 100%;
}

.notification-options {
  font-size: 12px;
  padding-left: 5px;
  width: 40px;
}

@keyframes slideIn {
  0% {
    transform: translateX(4000px);
  }
  100% {
    transform: translateX(calc(100vw - 400px));
  }
}

              
            
!

JS

              
                const EMAIL =
  "https://cdn2.iconfinder.com/data/icons/social-icons-circular-color/512/gmail-512.png";
const IMESSAGE =
  "https://help.apple.com/assets/5CA2B98509462224109A65C3/5CA2B98909462224109A65CB/en_US/fe9efa2e670f770a12833f801b8b4387.png";
const SLACK = "https://cdn.svgporn.com/logos/slack-icon.svg";
const GF = "https://randomuser.me/api/portraits/women/8.jpg";
const MAN = () =>
  `https://randomuser.me/api/portraits/men/${Math.ceil(
    Math.random() * 99
  )}.jpg`;
const WOMAN = () =>
  `https://randomuser.me/api/portraits/women/${Math.ceil(
    Math.random() * 99
  )}.jpg`;

const DATA = [
  {
    id: 1,
    icon: MAN(),
    header: "Lafayette",
    text: "Cant wait to get fking HAMMERED 2nite!"
  },
  {
    id: 2,
    icon: SLACK,
    header: "Jimmy",
    text: "Fuck this client, seriously"
  },
  {
    id: 3,
    icon: GF,
    header: "GF",
    text: "we need to talk..."
  },
  {
    id: 4,
    icon: GF,
    header: "GF",
    text: "I missed my period.... AGAIN"
  },
  {
    id: 5,
    icon: EMAIL,
    header: "STD TEST",
    text: "Tomorrow at 12:30PM",
    options: ["Reply", "Delete"]
  },
  {
    id: 6,
    icon: MAN(),
    header: "George III",
    text: "Cant believe John Adams got promoted.. WTF",
    options: ["Reply", "Delete"]
  },
  {
    id: 7,
    icon: WOMAN(),
    header: "Angelica",
    text: "Alexander has been cheating on Eliza"
  },
  {
    id: 8,
    icon: IMESSAGE,
    header: "Vinny",
    text: "Wheres my fkin money, Im outside your office",
    options: ["Reply", "Delete"]
  },
  {
    id: 9,
    icon: SLACK,
    header: "Kamala",
    text: "Donald is such an asshole!"
  },
  {
    id: 10,
    icon: SLACK,
    header: "George W.",
    text: "Heads up, Thomas wants to fire you.."
  },
  {
    id: 11,
    icon: SLACK,
    header: "Eliza",
    text: "Aaron is such a tool!"
  },
  {
    id: 12,
    icon: GF,
    header: "GF",
    text: "WHO'S MARIA REYNOLDS?!?!",
    options: ["Reply", "Delete"]
  },
  {
    id: 13,
    icon: IMESSAGE,
    header: "Maria - girl from bar",
    text: "soooooooo nice seeing you last night ;]",
    options: ["Reply", "Delete"]
  },
  {
    id: 14,
    icon: EMAIL,
    header: "Pornhub Premium renewal",
    text: "You autopay payment has been accepted!",
    options: ["Reply", "Delete"]
  },
  {
    id: 15,
    icon: EMAIL,
    header: "Job Interview Confirmation",
    text: "You're all set for the interview next Tues!",
    options: ["Reply", "Delete"]
  },
  {
    id: 16,
    icon: MAN(),
    header: "Dad",
    text: "Mom and I think its time for you to move out",
    options: ["Reply", "Delete"]
  },
  {
    id: 17,
    icon: WOMAN(),
    header: "Karen",
    text: "Which hepititas is curable again? A right?",
    options: ["Reply", "Delete"]
  },
  {
    id: 18,
    icon: IMESSAGE,
    header: "V. Corleone",
    text: "Kilo shipment comming this thursday, you in?"
  },
  {
    id: 18,
    icon: SLACK,
    header: "Bernie",
    text: "We are so overcharging this moron"
  }
];

const Notification = ({ props }) => {
  return (
    <div className="notification-container">
      <div className="notification-icon-container">
        <img className="notification-icon" src={props.icon}></img>
      </div>
      <div className="notification-data">
        <div className="notification-header">{props.header}</div>
        <div className="notification-text">{props.text}</div>
      </div>
      {props.options ? (
        <div className="notification-options">
          <div>{props.options[0]}</div>
          <div>{props.options[1]}</div>
        </div>
      ) : null}
    </div>
  );
};

const App = () => {
  let [ActiveNotifications, setNotifications] = React.useState([]);

  React.useEffect(() => {
    const timer = setInterval(() => {
      const rand = Math.floor(Math.random() * DATA.length);
      setNotifications((notification) => [...notification, DATA[rand]]);
    }, 2500);
    return () => clearTimeout(timer);
  }, []);

  const messagesEndRef = React.useRef(null);

  const scrollToBottom = () => {
    messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
  };

  React.useEffect(scrollToBottom, [ActiveNotifications]);

  return (
    <div>
      {ActiveNotifications.map((data) => (
        <Notification props={data} key={data.id} />
      ))}
      <div ref={messagesEndRef} />
    </div>
  );
};
ReactDOM.render(<App />, document.getElementById("root"));

              
            
!
999px

Console