Skip to content

Commit

Permalink
chore: refactor code pull out css to style file
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupesh Tiwari committed Feb 16, 2023
1 parent 2ccf7c7 commit 4065f76
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 45 deletions.
40 changes: 3 additions & 37 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class App extends Component {
method: 'POST',
data: JSON.stringify(data),
headers: { 'Content-Type': 'application/json' },

url: api,
})
.then((response) => {
Expand All @@ -40,37 +39,8 @@ class App extends Component {
render() {
return (
<div className='container'>
<div
id='overlay'
style={{
position: 'absolute',
display: 'none',
width: '100%',
height: '100%',
top: '0',
left: '0',
right: '0',
bottom: '0',
backgroundColor: 'rgba(0,0,0,0.5)',
zIndex: '2',
cursor: 'pointer',
alignItems: 'center',
justifyContent: 'center',
}}
>
<div
style={{
position: 'absolute',
top: '50%',
left: '50%',
fontSize: '50px',
color: 'white',
transform: 'translate(-50%,-50%)',
msTransform: 'translate(-50%,-50%)',
}}
>
Loading your image please wait...
</div>
<div id='overlay'>
<div id='overlayText'>Loading your image please wait...</div>
</div>
<form onSubmit={this.handleSubmit}>
<h1> Welcome to Stable Diffusion AI</h1>
Expand All @@ -89,11 +59,7 @@ class App extends Component {
<img
id='myImage'
alt='Your Image will appear here'
style={{
maxInlineSize: '100%',
blockSize: 'auto',
aspectRatio: '2/1.5',
}}
className='imageContainer'
/>
</div>
</form>
Expand Down
49 changes: 41 additions & 8 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/* Style inputs with type="text", select elements and textareas */
input[type=text], select, textarea {
/* Style inputs with type="text", select elements and textareas */
input[type='text'],
select,
textarea {
width: 100%; /* Full width */
padding: 12px; /* Some padding */
padding: 12px; /* Some padding */
border: 1px solid #ccc; /* Gray border */
border-radius: 4px; /* Rounded borders */
box-sizing: border-box; /* Make sure that padding and width stays in place */
margin-top: 6px; /* Add a top margin */
margin-bottom: 16px; /* Bottom margin */
resize: vertical /* Allow the user to vertically resize the textarea (not horizontally) */
resize: vertical; /* Allow the user to vertically resize the textarea (not horizontally) */
}

/* Style the submit button with a specific background color etc */
input[type=submit] {
background-color: #04AA6D;
input[type='submit'] {
background-color: #04aa6d;
color: white;
padding: 12px 20px;
border: none;
Expand All @@ -21,7 +23,7 @@ input[type=submit] {
}

/* When moving the mouse over the submit button, add a darker green color */
input[type=submit]:hover {
input[type='submit']:hover {
background-color: #45a049;
}

Expand All @@ -30,4 +32,35 @@ input[type=submit]:hover {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
}

#overlay {
position: fixed;
display: none;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.5);
z-index: 2;
cursor: pointer;
align-items: 'center';
justify-content: 'center';
}

#overlayText {
position: absolute;
top: 50%;
left: 50%;
font-size: 50px;
color: white;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}

#myImage {
max-inline-size: '100%';
block-size: 'auto';
}

0 comments on commit 4065f76

Please sign in to comment.