Variable Buttons
Padding, width, height, text are optional, if not set there are default values (no css)
This commit is contained in:
+11
-3
@@ -1,6 +1,4 @@
|
|||||||
|
.round-border
|
||||||
|
|
||||||
.round-border-10
|
|
||||||
{
|
{
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
@@ -12,7 +10,17 @@
|
|||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.font-small
|
||||||
|
{
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
.font-middle
|
.font-middle
|
||||||
{
|
{
|
||||||
font-size: 20px ;
|
font-size: 20px ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.font-big
|
||||||
|
{
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
+1
-2
@@ -1,11 +1,10 @@
|
|||||||
import logo from './logo.svg';
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import Button from "./components/Button";
|
import Button from "./components/Button";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Button text={"Test"} PaddingX={20} PaddingY={10}/>
|
<Button/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,27 @@ import "../App.css"
|
|||||||
|
|
||||||
export default function Button(p) {
|
export default function Button(p) {
|
||||||
|
|
||||||
|
let text = p.text;
|
||||||
|
let paddingY = p.paddingY, paddingX = p.paddingX;
|
||||||
|
let width = p.width, height = p.height;
|
||||||
|
let color = p.color;
|
||||||
|
|
||||||
|
if (paddingY == null) paddingY = 10;
|
||||||
|
if (paddingX == null) paddingX = 20;
|
||||||
|
if (height == null) height = 50;
|
||||||
|
if (width == null) width = 100;
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button className={"default-button round-border-10 font font-middle"}
|
<button className={"default-button round-border font font-middle"}
|
||||||
style={{
|
style={{
|
||||||
paddingTop: p.PaddingY,
|
paddingTop: paddingY,
|
||||||
paddingBottom: p.PaddingY,
|
paddingBottom: paddingY,
|
||||||
paddingLeft: p.PaddingX,
|
paddingLeft: paddingX,
|
||||||
paddingRight: p.PaddingX
|
paddingRight: paddingX,
|
||||||
}}>{p.text}</button>
|
width: width,
|
||||||
|
height: height,
|
||||||
|
color: color
|
||||||
|
}}>{text}</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user