Skip to content

Instantly share code, notes, and snippets.

@melanyss
Created June 3, 2020 12:20
Show Gist options
  • Select an option

  • Save melanyss/c80e7d34d680997c04430dd0abe10a37 to your computer and use it in GitHub Desktop.

Select an option

Save melanyss/c80e7d34d680997c04430dd0abe10a37 to your computer and use it in GitHub Desktop.
Startup name generator
<form id='form' class='input-form'>
<label>Let's name your startup using the words:</label>
<input type='text' class='input' id='input' placeholder='some words' value='run fit'>
<button class='submit'>Go</button>
</form>
<div id='results' class='results-list'>
</div>
$('#form').on('submit', e => {
e.preventDefault()
var input = $('#input').val()
var $results = $('#results')
var items = StartupNameGenerator(input)
$results.html('')
items.forEach((item, idx) => {
$('<a class="result-item" target="_blank">')
.html(`<span>${item}</span>`)
.attr('href', `https://www.namecheap.com/domains/registration/results.aspx?domain=${item.toLowerCase()}.com`)
.appendTo($results)
})
})
<script src="https://unpkg.com/@rstacruz/startup-name-generator@0.2.1/dist/startup-name-generator.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
@use postcss-cssnext;
@import url('https://fonts.googleapis.com/css?family=Work+Sans:200,400,700,900');
body {
background: #eee;
}
body, input {
font-family: 'work sans', sans-serif;
color: #303040;
}
.input-form {
text-align: center;
border-bottom: solid 1px #ddd;
padding: 16px;
background: white;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}
.input-form > label {
display: inline;
font-weight: bold;
}
.input-form > .input {
border: 0;
border-bottom: solid 1px #ccc;
padding: 8px 0;
width: 128px;
}
.input-form > .input:focus {
border-bottom-color: #333;
}
.input-form > .submit {
background: #333;
color: #fff;
border: 0;
padding: 0 8px;
height: 32px;
width: 64px;
border-radius: 3px;
margin-left: 16px;
font-weight: bold;
text-align: center;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.02em;
cursor: pointer;
}
.results-list {
max-width: 960px;
padding: 16px;
margin: 64px auto 16px auto;
display: flex;
flex-wrap: wrap;
}
.result-item {
display: block;
flex: 0 0 50%;
flex-wrap: wrap;
font-size: 18px;
color: #333;
text-decoration: none;
}
@media (min-width: 768px) {
.result-item {
flex: 0 0 33%;
}
.result-item:nth-child(3n+1) {
transform: translate3d(0, -48px, 0);
}
.result-item:nth-child(3n+3) {
transform: translate3d(0, 48px, 0);
}
}
.result-item > span {
display: block;
background: white;
height: 160px;
line-height: 160px;
margin: 8px;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
text-align: center;
animation: pop-in 300ms ease-out;
}
@media (min-width: 768px) {
.result-item > span {
margin: 16px;
}
}
.result-item > span {
font-size: 1.2em;
text-transform: uppercase;
letter-spacing: 0.2em;
font-size: 1.1em;
}
.result-item:hover > span {
transform: scale(0) translate3d(0, 0, 0);
transition: transform 150ms ease;
}
.result-item:nth-child(3n+2) > span {
text-transform: none;
font-weight: 200;
letter-spacing: 0;
font-size: 1.9em;
}
.result-item:nth-child(7n+3) > span {
text-transform: none;
font-weight: 700;
letter-spacing: -0.05em;
font-size: 1.7em;
}
.result-item:nth-child(5n+0) > span {
text-transform: uppercase;
font-weight: 900;
letter-spacing: 0.2em;
font-size: 1.1em;
}
.result-item:hover > span {
transform: scale(1) translate3d(0, 0, 0);
}
@media (min-width: 768px) {
.result-item:hover > span,
.result-item:nth-child(9n+5) > span {
background: #303030;
color: white;
transform: scale(1.05) translate3d(0, 0, 0);
}
.result-item:nth-child(9n+5) > span {
transform: scale(1.1) translate3d(0, 0, 0);
}
}
.results-list > hr {
flex: 1 1 100%;
background: #888;
height: 1px;
margin: 16px 32px;
}
@keyframes pop-in {
0% {
opacity: 0;
transform: scale(0.8);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment