JSFiddle - React, Tailwind, and code Playground

by evon0306

HTML

<link rel="stylesheet" href="./style/style.css">
<script src="https://kit.fontawesome.com/41e2a8dba7.js" crossorigin="anonymous"></script>

<label for="name">姓名:<input id="name" text="text"  placeholder="王小明"/></label>

<button class="order" onclick="order()">
   <i class="fa-regular fa-pen-to-square"></i>
   <div>我要訂購</div>
</button>

<button class="industry" onclick="industry()">
   <i class="fa-solid fa-industry"></i>
   <div>認識工廠</div>
</button>

<div class="order-info">
   <h2>您的訂單</h2>
   <ul>
      <li>顧客姓名 :   <span id="customer-name"></span></li>
   </ul>
</div>

CSS

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: none;
  list-style: none;
}
* li {
  padding: 10px 0;
}
* li span {
  padding: 10px 20;
  color: rgba(0, 99, 56, 0.859);
}

label {
  margin: 1rem;
  display: flex;
  align-items: center;
  font: 1.2em sans-serif;
  padding: 10px;
}
label #name {
  background-color: rgb(196, 196, 196);
  color: rgba(0, 99, 56, 0.859);
  font-size: 1.1em;
  width: 170px;
  border-radius: 5px;
  padding: 5px;
}

button {
  height: 100px;
  width: 100px;
  padding: 1.2rem;
  margin-left: 1rem;
  border-radius: 50%;
  background-color: rgb(255, 255, 255);
  transition: all 0.3s ease;
  box-shadow: 0 0 7px rgba(0, 0, 0, 0.43);
}
button:hover {
  background-color: rgba(0, 99, 56, 0.859);
  color: white;
}

.order {
  margin-left: 2.5rem;
}
.order i {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}
.order div {
  font: 1.3em sans-serif;
}

.industry {
  margin-right: 2.5rem;
}
.industry i {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}
.industry div {
  font: 1.3em sans-serif;
}

.order-info {
  margin: 1rem;
  padding: 10px;
  width: 60%;
}
.order-info h2 {
  border-bottom: 1px solid rgb(196, 196, 196);
}

JavaScript

function order()
{
  var name = document.getElementById('name').value;
  alert(name+"您好!謝謝您對我們的衣服有興趣!請致電 0987-654-321,會有專人提供您報價!");
  document.getElementById('customer-name').textContent = name;
}

function industry()
{
  alert('我們工廠位於新北市,通過國際 ISO9001 認證,品質讓您放心!');
}