Skip to content

Commit

Permalink
merge pull request #2 from bracamontesman/optimization
Browse files Browse the repository at this point in the history
css optimization with variables
  • Loading branch information
bracamontesman authored Aug 18, 2024
2 parents 766eb7d + b364c64 commit a3f9747
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 37 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<!-- Main content section -->
<section class="container">

<!-- Left side upper logo -->
<!-- Left side: Upper logo -->
<div class="logo">
<img src="img/logo.png" alt="Alura logo" class="logo__image">
</div>

<!-- Text input and buttons area -->
<!-- Center: Text input and buttons -->
<div class="input">
<textarea id="inputText" placeholder="enter text here"></textarea>
<p class="input__requirement"><i class="fa-solid fa-circle-info"></i> a-z only, no specials</p>
Expand All @@ -30,7 +30,7 @@
<p id="warningMessage" class="input__warning"></p>
</div>

<!-- Result/message area -->
<!-- Right side: Result text area -->
<div class="results" id="cipherOutput">
<div id="defaultMessage">
<img src="img/muñeco.png" id="defaultImage" alt="Default Image">
Expand Down
145 changes: 111 additions & 34 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,50 +1,72 @@
:root {
--font-family: "Inter", sans-serif;
--font-size-base: 16px;
--background-color: #f3f5fc;
--primary-color: #0a3871;
--secondary-color: #495057;
--button-padding: 0.8rem;
--button-border-radius: 1.5rem;
--button-border-width: 0.063rem;
--button-border-color: #0a3871;
--button-background: transparent;
--button-cursor: pointer;
--results-background: #ffffff;
--results-border-radius: 2rem;
--results-padding: 1.5rem;
--results-box-shadow: 0 1.5rem 2rem rgba(0, 0, 0, 8%);
--image-width: 100%;
--image-height: auto;
--warning-color: red;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body, html {
font-family: "Inter", sans-serif;
background-color: #f3f5fc;
font-family: var(--font-family);
font-size: var(--font-size-base);
background-color: var(--background-color);
height: 100%;
}

textarea {
width: auto;
height: 70%;
background: transparent;
border: none;
box-shadow: none;
outline: none;
resize: none;
font-family: "Inter", sans-serif;
font-size: 32px;
color: #0a3871;
}

/* Container for the entire layout */
.container {
display: flex;
flex-direction: row;
justify-content: center;
gap: 1rem;
height: 100vh;
padding: 40px;
padding: 2.5rem;
}

/* Left side, logo */
.logo {
flex: 1;
max-width: 120px;
max-width: 7.5rem;
}

.logo__image {
width: 31px;
height: 50px;
width: 1.938rem;
height: 3.125rem;
}

/* Center side: Text input area */
textarea {
width: auto;
height: 70%;
background: transparent;
border: none;
box-shadow: none;
outline: none;
resize: none;
font-family: var(--font-family);
font-size: 2rem;
color: var(--primary-color);
}

.input {
display: flex;
flex: 2;
Expand All @@ -53,42 +75,86 @@ textarea {
}

.input__requirement {
font-size: 12px;
color: #495057;
font-size: 0.75rem;
color: var(--secondary-color);
}

.input__warning {
color: red;
font-size: 14px;
margin-top: 10px;
color: var(--warning-color);
font-size: 0.875rem;
margin-top: 0.625rem;
display: none;
}

.buttons {
display: flex;
align-items: center;
gap: 1rem;
margin-top: 1rem;
margin-bottom: 0;
max-width: 100%;
}

#encrypt, #decrypt, #copyText {
width: 20.5rem;
max-width: 100%;
padding: var(--button-padding);
border-radius: var(--button-border-radius);
border: var(--button-border-width) solid var(--button-border-color);
background: var(--button-background);
outline: none;
text-decoration: none;
margin: 0;
font: inherit;
cursor: var(--button-cursor);
}

/* Right side: Default image and Results */
.results {
display: flex;
flex: 3;
flex-direction: column;
justify-content: center;
max-width: 400px;
background-color: #ffffff;
border-radius: 32px;
padding: 32px;
max-width: 25rem;
background-color: var(--results-background);
border-radius: var(--results-border-radius);
padding: var(--results-padding);
box-shadow: var(--results-box-shadow);
}

/* Basic styling for the container and image */
#defaultMessage {
display: flex;
flex-direction: column;
align-items: center; /* centers content horizontally */
align-items: center;
}

#defaultImage {
width: 100%; /* adjust as needed */
height: auto; /* maintains aspect ratio */
width: var(--image-width);
height: var(--image-height);
}

#resultContainer {
display: flex;
}

#resultText {
overflow-wrap: break-word;
word-break: break-word;
white-space: pre-wrap;
box-sizing: border-box;
}

#copyText {
margin-top: auto;
border-radius: var(--button-border-radius); /* Consistent button styling */
border: var(--button-border-width) solid var(--button-border-color); /* Consistent button styling */
background: var(--button-background); /* Consistent button styling */
cursor: var(--button-cursor); /* Pointer cursor on hover */
}

@media (max-width: 900px) {

/* Responsiveness */
@media (max-width: 1200px), (max-width: 450px) {
.container {
flex-direction: column;
}
Expand All @@ -100,4 +166,15 @@ textarea {
#defaultImage {
display: none;
}
}

.buttons {
max-width: 100%;
justify-content: center;
}

@media (max-width: 450px) {
.buttons {
flex-direction: column;
}
}
}

0 comments on commit a3f9747

Please sign in to comment.