Skip to content

Commit 0a64c90

Browse files
committed
Day 17.
1 parent 382ac43 commit 0a64c90

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Sort Without Articles</title>
6+
<link rel="stylesheet" href="style.css">
7+
</head>
8+
<body>
9+
10+
<ul id="bands"></ul>
11+
12+
<script>
13+
const bands = [
14+
'The Plot in You',
15+
'The Devil Wears Prada',
16+
'Pierce the Veil',
17+
'Norma Jean',
18+
'The Bled',
19+
'Say Anything',
20+
'The Midway State',
21+
'We Came as Romans',
22+
'Counterparts',
23+
'Oh, Sleeper',
24+
'A Skylit Drive',
25+
'Anywhere But Here',
26+
'An Old Dog'
27+
];
28+
29+
function stripLeadingArticle( string ) {
30+
return string.replace( /^(an?|the)\s/i, '' );
31+
}
32+
33+
const sortedBands = bands.sort( ( a, b ) => stripLeadingArticle( a ) > stripLeadingArticle( b ) );
34+
35+
document.getElementById( 'bands' ).innerHTML = sortedBands.map( ( b ) => `<li>${b}</li>` ).join('');
36+
</script>
37+
38+
</body>
39+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
body {
2+
font-family: sans-serif;
3+
background: url("https://source.unsplash.com/nDqA4d5NL0k/2000x2000");
4+
background-size: cover;
5+
display: flex;
6+
align-items: center;
7+
min-height: 100vh;
8+
}
9+
10+
a {
11+
color: #ffc600;
12+
text-decoration: none;
13+
}
14+
15+
#bands {
16+
list-style: inside square;
17+
font-size: 20px;
18+
background: white;
19+
width: 500px;
20+
margin: auto;
21+
padding: 0;
22+
box-shadow: 0 0 0 20px rgba(0, 0, 0, 0.05);
23+
}
24+
25+
#bands li {
26+
border-bottom: 1px solid #efefef;
27+
padding: 20px;
28+
}
29+
30+
#bands li:last-child {
31+
border-bottom: 0;
32+
}

0 commit comments

Comments
 (0)