<main>
		<div id="dynamic-island-container" class="dynamic-island-small">
				<div class="dynamic-island-small-content">
						<div class="dynamic-island-left">
								<nav>
										<a href="#">
											  <i class="fas fa-home"></i>
									  </a>
										<a href="#" data-dynamic="notification">
												<i class="fas fa-bell"></i>
										</a>
								</nav>
						</div>

						<div class="dynamic-island-right">
								<nav>
										<a href="#" data-dynamic="profile">
												<i class="fas fa-user"></i>
										</a>
								</nav>
						</div>
				</div>

				<div class="dynamic-island-large-content" id="notification">
						<div class="dynamic-island-header-section">
								<div class="dynamic-island-header-left">
										<span class="dynamic-island-title">Notifications</span>
								</div>

								<div class="dynamic-island-header-right">
										<a href="#">
												<span class="dynamic-island-title">SHOW ALL</span>
										</a>
								</div>
						</div>

						<div class="notification-container">
								<div class="notification-item">
										<span class="notification-item-title">Post have already uploaded.</span>
										<span class="notification-item-description">You can view your post by clicking here.</span>
								</div>

								<div class="notification-item">
										<span class="notification-item-title">1 people like your post.</span>
										<span class="notification-item-description">.</span>
								</div>
						</div>
				</div>

				<div class="dynamic-island-large-content" id="profile">
						<div class="dynamic-island-header-section">
								<div class="dynamic-island-header-left">
										<span class="dynamic-island-title">Profile</span>
								</div>
						</div>

						<div class="profile-container">
								<div class="profile-user-container">
										<img class="profile-user-image" src="https://www.pngrepo.com/png/65743/512/boy.png" alt="">

										<div class="profile-user-text-container">
												<span class="profile-user-name">Bambang Soekarnowirdjo</span>
												<span class="profile-user-username">@bambang</span>
										</div>
								</div>
						</div>
				</div>
		</div>

		<section class="section-group">
				<div class="section-title">RECENT POSTS</div>

				<div class="section-post">
						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>

						<div class="post-item">
								<h1>Create your own website.</h1>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
						</div>
				</div>
		</section>
</main>
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    max-width: 450px;
    margin: auto;

    background-color: #eee;

    position: relative;

    font-family: "Helvetica Neue", arial, sans-serif;
}

#dynamic-island-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);

    margin: 0 auto;
    padding: 18px;

    background-color: #222;
    color: #fff;
    border-radius: 30px;

    height: fit-content;

    transition: all .5s ease;
}

#dynamic-island-container a {
    text-decoration: none;
    color: #fff;
}

.dynamic-island-small {
    width: 250px;
    min-height: 18px;

    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
}

.dynamic-island-large {
    width: calc(450px - 40px);
    min-height: 190px;

    box-shadow: 0 1rem 3rem rgba(0,0,0,.175) !important;
}

#notification {
    width: 100%;
    min-height: 160px !important;
}

.dynamic-island-small-content {
    display: flex;
    width: 100%;
    justify-content: space-between;

    transition: all .2s ease;
}

.dynamic-island-left nav {
    display: flex;
    flex-direction: row;
}

.dynamic-island-left nav a {
    margin-right: 8px;
}

.dynamic-island-left nav a:last-child {
    margin-right: 0px;
}

.dynamic-island-left nav a img {
    height: 20px;
}

.dynamic-island-right nav {
    display: flex;
    flex-direction: row;
}

.dynamic-island-right nav a {
    margin-right: 8px;
}

.dynamic-island-right nav a:last-child {
    margin-right: 0px;
}

.dynamic-island-right nav a img {
    height: 20px;
}

.dynamic-island-large-content {
    display: none;
    opacity: 0;
    width: 100%;
    
    transition: all .2s ease;
}

.dynamic-island-title {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;

    margin-bottom: 12px;

    display: block;
}

.dynamic-island-header-section {
    display: flex;
    width: 100%;
    justify-content: space-between;

    transition: all .2s ease;
}

.notification-item {
    padding: 12px;
    border-radius: 12px;
    background-color: #000;

    margin-bottom: 6px;
}

.notification-item:last-child {
    margin-bottom: 0px;
}

.notification-item-title, .notification-item-description {
    margin: 0;
    font-size: 14px;
    line-height: 20px;

    display: block;
}

.notification-item-title {
    font-weight: 700;
}

.profile-user-container {
    display: flex;
    align-items: center;
}

.profile-user-image {
    width: 60px;
    border-radius: 50%;
    margin: 8px;
}

.profile-user-text-container {
	display: flex;
	flex-direction: column;
}

.profile-user-name {
    font-size: 18px;
    text-overflow: ellipsis;
    font-weight: 700;
    margin-bottom: 6px;
}

.profile-user-username {
    text-overflow: ellipsis;
}

#profile {
    max-height: 76px !important;
}

main {
    padding-top: 110px;
    background-color: #ddd;
}

.section-title {
    background-color: #fff;
    padding: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;

    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
}

.post-item {
    background-color: #fff;
    padding: 8px;
    overflow: hidden;
    margin: 6px 0;

    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
}

.post-item h1 {
    font-size: 12px;
    text-transform: uppercase;
    margin-top: 0;
}

.post-item p {
    margin: 0;
    font-size: 14px;
    line-height: 18px;

    text-overflow: ellipsis;
}

@media screen and (max-width: 449.999px) {
    .dynamic-island-large {
        width: calc(100% - 40px);
        min-height: 190px;
    
        box-shadow: 0 1rem 3rem rgba(0,0,0,.175) !important;
    }
}
const toggleDynamicIsland = (id) => {
    setTimeout(() => {
        document.querySelector(".dynamic-island-small-content").style.opacity = 0;
        setTimeout(() => {
            document.querySelector(".dynamic-island-small-content").style.display = "none";
            document.querySelector(id).style.display = "block";

            setTimeout(() => {
                document.querySelector(id).style.opacity = 1;
            }, 50);
        }, 200);

        document.querySelector("#dynamic-island-container").classList.remove("dynamic-island-small");
        document.querySelector("#dynamic-island-container").classList.add("dynamic-island-large");

        switch (id) {
            case "#notification":
                document.querySelector(".dynamic-island-large").style.minHeight = "160px";
                return;
            case "#profile":
                document.querySelector(".dynamic-island-large").style.minHeight = "132px";
                return;
            default:
                return;
        }
    }, 1);
}

const hideDynamicIsland = (id) => {
    setTimeout(() => {
        document.querySelector(".dynamic-island-large-content").style.opacity = 0;
        setTimeout(() => {
            document.querySelector(id).style.display = "none";
            document.querySelector(".dynamic-island-small-content").style.display = "flex";

            setTimeout(() => {
                document.querySelector(".dynamic-island-small-content").style.opacity = 1;
            }, 50);
        }, 120);

        document.querySelector("#dynamic-island-container").classList.remove("dynamic-island-large");
        document.querySelector("#dynamic-island-container").classList.add("dynamic-island-small");
    }, 1);
}

document.querySelector("nav a[data-dynamic='notification']").addEventListener("click", (e) => {
    e.preventDefault();

    toggleDynamicIsland("#notification");
});

document.querySelector("nav a[data-dynamic='profile']").addEventListener("click", (e) => {
    e.preventDefault();

    toggleDynamicIsland("#profile");
});

document.body.addEventListener("click", (e) => {
    console.log(document.elementsFromPoint(e.clientX, e.clientY));
    // console.log(document.elementsFromPoint(e.clientX, e.clientY).map(x => { console.log(x.id) }));
    const elements = document.elementsFromPoint(e.clientX, e.clientY);

    console.log("ini elementnya", elements.find((x) => { return x.id === "dynamic-island-container"; }));

    if ((elements.find((x) => x.id === "dynamic-island-container")) === undefined) {
        document.querySelector(".dynamic-island-large").style.minHeight = "18px";

        hideDynamicIsland("#notification");
        hideDynamicIsland("#profile");
    }
})

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://use.fontawesome.com/releases/v5.0.6/js/all.js