Skip to content

Instantly share code, notes, and snippets.

@jakedowns
Created December 20, 2023 04:58
Show Gist options
  • Select an option

  • Save jakedowns/071a08c29189293dfe533af09d4233b0 to your computer and use it in GitHub Desktop.

Select an option

Save jakedowns/071a08c29189293dfe533af09d4233b0 to your computer and use it in GitHub Desktop.
Modals Generated with TLDRAW's Make Real
<!DOCTYPE html>
<!-- via https://twitter.com/jakedowns/status/1737336410221195449 -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Modals</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
}
.modal-bg {
background-color: white;
border-radius: 0.5rem;
padding: 2rem;
width: 100%;
max-width: 32rem;
margin: 2rem auto;
}
.modal-header {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1.5rem;
}
.modal-footer {
display: flex;
justify-content: flex-end;
margin-top: 1.5rem;
}
.btn {
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
font-size: 1rem;
margin-left: 0.5rem;
}
.btn-cancel {
background-color: #E5E7EB;
color: #374151;
}
.btn-save, .btn-ok, .btn-action {
background-color: #3B82F6;
color: white;
}
.given-bg { background-color: #D1FAE5; }
.when-bg { background-color: #E9D5FF; }
.then-bg { background-color: #FFEDD5; }
</style>
</head>
<body class="bg-gray-50">
<div class="modal-bg">
<div class="modal-header">Edit Details</div>
<div class="mb-4">
<label for="given" class="block text-sm font-medium text-gray-700">Given</label>
<input id="given" type="text" placeholder="Enter a condition..." class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 given-bg">
</div>
<div class="mb-4">
<label for="when" class="block text-sm font-medium text-gray-700">When</label>
<input id="when" type="text" placeholder="Enter an action..." class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 when-bg">
</div>
<div class="mb-4">
<label for="then" class="block text-sm font-medium text-gray-700">Then</label>
<input id="then" type="text" placeholder="Enter the outcome..." class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 then-bg">
</div>
<div class="modal-footer">
<button class="btn btn-cancel">Cancel</button>
<button class="btn btn-save">Save</button>
</div>
</div>
<div class="modal-bg">
<div class="modal-header">Alert</div>
<p>Please confirm that you want to proceed with the action.</p>
<div class="modal-footer">
<button class="btn btn-ok">OK</button>
</div>
</div>
<div class="modal-bg">
<div class="modal-header">Prompt</div>
<p>What is your reason for this action?</p>
<textarea id="prompt" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" rows="4" placeholder="Enter your reason..."></textarea>
<div class="modal-footer">
<button class="btn btn-action">Action</button>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment