Styled buttons

This commit is contained in:
Koper
2023-07-18 17:38:35 +07:00
parent 0a5070b248
commit 6c8caaab09
4 changed files with 132 additions and 11 deletions

View File

@@ -153,13 +153,16 @@ export function Dashboard(props) {
<AudioVisualizer isRecording={props.isRecording} />
<button
className="mx-auto mt-6 mb-9"
onClick={() => props.onRecord(!props.isRecording)}
className={`px-4 py-2 mb-4 text-2xl font-bold rounded ${
props.isRecording ? "bg-red-500" : "bg-blue-500"
}`}
data-color={props.isRecording ? "red" : "blue"}
>
{props.isRecording ? "STOP" : "RESUME"}
</button>
<footer className="w-full bg-gray-800 text-center py-4 mt-4 text-white">
Reflector © 2023 Monadical
</footer>
</div>
</>
);

View File

@@ -25,17 +25,11 @@ export default function Record(props) {
<div className="flex flex-col items-center justify-center flex-grow -mt-10">
{!props.isRecording ? (
<button
onClick={startRecording}
className="px-4 py-2 mb-4 text-2xl font-bold text-white bg-blue-500 rounded"
>
<button onClick={startRecording} data-color="blue">
Record
</button>
) : (
<button
onClick={stopRecording}
className="px-4 py-2 mb-4 text-2xl font-bold text-red-500 rounded"
>
<button onClick={stopRecording} data-color="red">
Stop
</button>
)}

View File

@@ -3,6 +3,7 @@ import React, { useState, useEffect } from "react";
import Record from "./components/record.js";
import { Dashboard } from "./components/dashboard.js";
import useWebRTC from "./components/webrtc.js";
import "../public/button.css";
const App = () => {
const [isRecording, setIsRecording] = useState(false);

123
public/button.css Normal file
View File

@@ -0,0 +1,123 @@
/* Define basic button styles */
input[type="button"],
button {
/* Reset default button styles */
border: none;
background-color: transparent;
font-family: inherit;
padding: 0;
cursor: pointer;
/* Visual */
background-color: #3e68ff;
color: #fff;
border-radius: 8px;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.18);
/* Size */
padding: 0.25em 0.75em;
min-width: 10ch;
min-height: 44px;
/* Text */
text-align: center;
line-height: 1.1;
/* Display */
display: inline-flex;
align-items: center;
justify-content: center;
align-self: start;
/* Optional - see "Gotchas" */
/* Animation */
transition: 220ms all ease-in-out;
display: block;
}
/* Button modifiers */
input[type="button"].small,
button.small {
font-size: 1.15rem;
}
input[type="button"].block,
button.block {
width: 100%;
}
/* Disabled styles */
input[type="button"][disabled],
button[disabled] {
border-color: #ccc;
background-color: #eee;
cursor: not-allowed;
}
input[type="button"][disabled]:hover,
button[disabled]:hover {
background: #b8b8b8 !important;
cursor: not-allowed !important;
}
/* Custom button properties */
input[type="button"],
button {
width: 243px;
border: solid 1px #dadada;
}
/* Red button states */
input[type="button"][data-color="red"],
button[data-color="red"],
input[type="button"][data-color="red"]:hover,
button[data-color="red"]:hover,
input[type="button"][data-color="red"]:active,
button[data-color="red"]:active {
background-color: #cc3347;
}
/* Green button states */
input[type="button"][data-color="green"],
button[data-color="green"],
input[type="button"][data-color="green"]:hover,
button[data-color="green"]:hover,
input[type="button"][data-color="green"]:active,
button[data-color="green"]:active {
background-color: #33cc47;
}
/* Blue button states */
input[type="button"][data-color="blue"],
button[data-color="blue"],
input[type="button"][data-color="blue"]:hover,
button[data-color="blue"]:hover,
input[type="button"][data-color="blue"]:active,
button[data-color="blue"]:active {
background-color: #3347cc;
}
/* Orange button states */
input[type="button"][data-color="orange"],
button[data-color="orange"],
input[type="button"][data-color="orange"]:hover,
button[data-color="orange"]:hover,
input[type="button"][data-color="orange"]:active,
button[data-color="orange"]:active {
background-color: #ff7f00;
}
/* Purple button states */
input[type="button"][data-color="purple"],
button[data-color="purple"],
input[type="button"][data-color="purple"]:hover,
button[data-color="purple"]:hover,
input[type="button"][data-color="purple"]:active,
button[data-color="purple"]:active {
background-color: #800080;
}
/* Yellow button states */
input[type="button"][data-color="yellow"],
button[data-color="yellow"],
input[type="button"][data-color="yellow"]:hover,
button[data-color="yellow"]:hover,
input[type="button"][data-color="yellow"]:active,
button[data-color="yellow"]:active {
background-color: #ffff00;
}