naoshite request-list
by takumi091111
HTML
<ul class="c-list">
<li class="c-list-item">
<a class="c-list-item__link" href="#">
<img class="c-request-list-item__thumbnail" src="http://placehold.jp/200x130.png" alt="サムネイル">
</a>
<div class="c-list-item__info">
<p class="c-list-item__date">2021.01.01</p>
<button class="c-list-item__trash-button">
<img class="c-list-item__trash-icon" src="http://placehold.jp/12x14.png" alt="削除">
</button>
</div>
<a class="c-list-item__link" href="#">
<p class="c-list-item__title">無題の修正依頼</p>
</a>
</li>
<li class="c-list-item">
<a class="c-list-item__link" href="#">
<img class="c-request-list-item__thumbnail" src="http://placehold.jp/200x130.png" alt="サムネイル">
</a>
<div class="c-list-item__info">
<p class="c-list-item__date">2021.01.01</p>
<button class="c-list-item__trash-button">
<img class="c-list-item__trash-icon" src="http://placehold.jp/12x14.png" alt="削除">
</button>
</div>
<a class="c-list-item__link" href="#">
<p class="c-list-item__title">無題の修正依頼</p>
</a>
</li>
<li class="c-list-item">
<a class="c-list-item__link" href="#">
<img class="c-request-list-item__thumbnail" src="http://placehold.jp/200x130.png" alt="サムネイル">
</a>
<div class="c-list-item__info">
<p class="c-list-item__date">2021.01.01</p>
<button class="c-list-item__trash-button">
<img class="c-list-item__trash-icon" src="http://placehold.jp/12x14.png" alt="削除">
</button>
</div>
<a class="c-list-item__link" href="#">
<p class="c-list-item__title">無題の修正依頼</p>
</a>
</li>
<li class="c-list-item">
<a class="c-list-item__link" href="#">
<img class="c-request-list-item__thumbnail" src="http://placehold.jp/200x130.png" alt="サムネイル">
</a>
<div class="c-list-item__info">
<p class="c-list-item__date">2021.01.01</p>
<button class="c-list-item__trash-button">
<img...
SCSS
/* ここからリセットCSS */
* {
padding: 0;
margin: 0;
line-height: 1;
}
body {
margin: 10px;
}
li {
list-style: none;
}
/* ここからコンポーネント */
.c-list {
display: grid;
grid-template-columns: repeat(4, max-content);
grid-auto-rows: 1fr;
column-gap: 10px;
row-gap: 20px;
justify-content: center;
border: 1px solid gray;
@media (max-width: 850px) {
// スマホでは2列で折り返す
grid-template-columns: repeat(2, max-content);
}
}
.c-list-item {
display: grid;
row-gap: 10px;
border: 1px solid gray;
&__link {
text-decoration: none;
color: black;
}
&__thumbnail {
width: 100%;
}
&__info {
display: flex;
align-items: center;
justify-content: space-between;
}
&__date {
font-size: 13px;
}
&__trash-button {
background-color: transparent;
border: none;
outline: none;
cursor: pointer;
}
&__trash-icon {
width: 100%;
}
&__title {
font-size: 18px;
font-weight: bold;
}
}