Skip to content

Instantly share code, notes, and snippets.

@damilolaolatunji
Last active August 3, 2023 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save damilolaolatunji/111a5f86fb980d716656963289981ba5 to your computer and use it in GitHub Desktop.
Save damilolaolatunji/111a5f86fb980d716656963289981ba5 to your computer and use it in GitHub Desktop.
Stylesheet for Hacker News App
html {
box-sizing: border-box;
}
*, *::before, *::after {
box-sizing: inherit;
margin: 0;
padding: 0;
}
:root {
--light-orange: #ff6600;
--dark-green: #003b00;
--dark-grey: #777;
--light-grey: #dadce0;
--white: #fff;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
background-color: var(--light-grey);
}
.home-search {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
max-width: 600px;
text-align: center;
}
.home-search img {
margin-bottom: 20px;
}
.home-input {
outline: none;
box-shadow: none;
background-color: transparent;
border-radius: 4px;
padding: 10px 20px;
border: 1px solid var(--dark-grey);
width: 100%;
}
a {
text-decoration: none;
color: #333;
}
a:hover {
text-decoration: underline;
}
a.button {
border: 2px solid #004400;
color: var(--dark-green);
border-radius: 4px;
padding: 6px 24px;
font-size: 14px;
font-weight: 400;
}
a.button:hover {
text-decoration: none;
background-color: var(--dark-green);
color: var(--light-orange);
}
.author {
color: var(--light-orange);
}
header {
width: 100%;
height: 50px;
position: fixed;
top: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-between;
background-color: var(--light-orange);
padding: 5px 10px;
align-items: center;
}
.logo {
color: #002200;
flex-basis: 10%;
}
form {
flex-basis: 50%;
flex-grow: 1;
flex-shrink: 1;
height: calc(100% - 10px);
margin-left: 10px;
margin-right: 10px;
}
.search-input {
width: 100%;
height: 100%;
border-radius: 4px;
border-color: transparent;
background-color: var(--dark-green);
color: var(--light-orange);
font-size: 16px;
line-height: 1.4;
padding-left: 5px;
}
.container {
width: 100%;
max-width: 1600px;
margin: 0 auto;
padding: 80px 20px 40px;
}
.result-count {
color: var(--dark-grey);
text-align: center;
margin-bottom: 15px;
}
.search-results {
display: grid;
grid-auto-rows: 1fr;
grid-template-columns: repeat(3, 1fr);
gap: 30px;
list-style: none;
}
.news-article {
border: 1px solid var(--dark-grey);
background-color: var(--white);
padding: 15px;
border-radius: 4px;
display: flex;
flex-direction: column;
}
.article-image {
width: 200px;
flex-grow: 0;
flex-shrink: 0;
margin-left: 20px;
}
.title {
margin-bottom: 15px;
}
.title-link {
flex-grow: 1;
}
.description {
color: var(--dark-grey);
margin-bottom: 15px;
}
.metadata {
color: var(--dark-green);
font-size: 14px;
margin-top: auto;
}
.created-date::after {
content: '\0000a0\002022\0000a0';
margin: 0 3px;
}
.pagination {
margin-top: 20px;
}
.previous-page {
margin-right: 20px;
}
@media screen and (max-width: 550px) {
header {
flex-direction: column;
height: auto;
padding-bottom: 10px;
}
.logo {
display: inline-block;
margin-bottom: 10px;
}
form, .search-input {
width: 100%;
}
.github-button {
display: none;
}
.title {
font-size: 18px;
}
.description {
font-size: 14px;
}
.article-image {
display: none;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment