Last active
February 5, 2025 01:00
-
-
Save dirumahrafif/1351a6767e8502a3fdaa00d515dfe3d6 to your computer and use it in GitHub Desktop.
Simple CRUD using MOCK UP API in React JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body, | |
html { | |
background-color: #ccc; | |
margin: auto; | |
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; | |
color: #333; | |
font-size: 15px; | |
} | |
.wrapper { | |
width: 600px; | |
margin-left: auto; | |
margin-right: auto; | |
margin-top: 20px; | |
} | |
.header { | |
background-color: #3F72AF; | |
padding: 20px; | |
border-radius: 10px 10px 0px 0px; | |
} | |
.data-pengguna { | |
background-color: #FFFFFF; | |
border-radius: 0px 0px 10px 10px; | |
padding: 20px; | |
} | |
.header h3 { | |
color: white; | |
margin: 0px 0px 20px; | |
font-size: 30px; | |
} | |
.data-pengguna h3 { | |
margin: 0px 0px 20px; | |
font-size: 30px; | |
} | |
@media only screen and (max-width: 800px) { | |
.wrapper { | |
width: 80%; | |
} | |
} | |
/** form */ | |
.input-box { | |
display: block; | |
width: 100%; | |
} | |
.input-box > input { | |
width: 100%; | |
background-color: #dedede; | |
border-radius: 10px; | |
padding: 10px 100px 10px 20px; | |
line-height: 1; | |
box-sizing: border-box; | |
outline: none; | |
border: none; | |
font-size: 16px; | |
margin-bottom: 10px; | |
} | |
.input-box > button { | |
border: 0; | |
background: #112d4e; | |
color: #fff; | |
font-weight: bold; | |
outline: none; | |
margin: 0; | |
border-radius: 10px; | |
cursor: pointer; | |
width: 100%; | |
font-size: 16px; | |
padding: 10px; | |
} | |
/** list */ | |
.data-pengguna > ul { | |
padding: 0px; | |
margin: 0px; | |
} | |
.data-pengguna > ul > li { | |
padding: 10px 0px 10px 0px; | |
list-style: none; | |
display: flex; | |
border-bottom: 1px solid #ccc; | |
justify-content: space-between; | |
} | |
.data-pengguna > ul > li > div > a { | |
text-decoration: none; | |
} | |
a.edit { | |
color: rgb(143, 143, 45); | |
} | |
a.delete { | |
color: red; | |
} | |
.wrapper > ul > li:last-child { | |
border-bottom: none; | |
} | |
.email { | |
color: #adadad; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import './App.css' | |
function App() { | |
return ( | |
<div className='wrapper'> | |
<div className='header'> | |
<h3>Tambah Pengguna</h3> | |
<form className='input-box' type='submit'> | |
<input type='text' placeholder='Nama' /> | |
<input type='email' placeholder='Email' /> | |
<button type='submit'>Simpan</button> | |
</form> | |
</div> | |
<div className='data-pengguna'> | |
<h3>Data Pengguna</h3> | |
<ul> | |
<li> | |
<div> | |
Nama Pengguna <span className='email'>(email@gmail.com)</span> | |
</div> | |
<div> | |
<a href='#' className='edit'>Edit</a> - <a href='#' className='delete'>Delete</a> | |
</div> | |
</li> | |
</ul> | |
</div> | |
</div> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment