このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
kikikan/backend/resources/sass/scss/object/project/_icon.scss

248 行
5.4 KiB
SCSS

/* #Icon
-------------------------------------------------------------------------- */
/*doc
---
title: icon
name: icon
categories: [project]
---
アイコンフォントを使ったアイコンを表示します。デフォルトでは`:before`擬似要素で表示されます。
サンプルコードはパンくずリストのホームをアイコンで(2つ目以降はアイコンだけで)示した場合の例です。
装飾的なアイコンは`<span>`と`aria-hidden="true"`でマークアップをします。
意味を伝えたいアイコンは`aria-label=""`でマークアップします。
テキスト全体を読み上げたときに違和感が出ないようにします。
テキストを表示できない場合は`.u-sr-only`でテキストをマークアップします(非表示のままスクリーンリーダーには読み上げられます)。
```block
<div>
<span class="p-icon p-icon--home" aria-hidden="true"></span>ホーム
</div>
<div>
<span class="p-icon p-icon--home" aria-label="ホーム"></span>
</div>
<div>
<span class="p-icon p-icon--home" aria-hidden="true"></span>
<span class="u-sr-only">ホーム</span>
</div>
```
*/
// 任意のクラスの擬似要素で表示する場合は@mixinを使って、
// ベーススタイルとアイコンの名前を取得します。
// @example scss
// .p-list__link {
// &:after {
// @include _p-icon;
// @include _p-icon-name(chevron-right);
// }
// }
@font-face {
font-family: "iconfont";
src: url('../font/iconfont.eot');
src: url('../font/iconfont.eot?#iefix') format('eot'),
url('../font/iconfont.woff') format('woff'),
url('../font/iconfont.ttf') format('truetype'),
url('../font/iconfont.svg#iconfont') format('svg');
font-weight: normal;
font-style: normal;
}
// アイコンフォントのベーススタイル
@mixin _p-icon {
font-family: "iconfont";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: relative;
top: -0.1em;
display: inline-block;
vertical-align: middle;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1;
text-decoration: none;
text-transform: none;
speak: none;
}
/* `p-icon p-icon--icon-name`のようなマルチクラスで指定します。 */
.p-icon:before {
@include _p-icon;
}
@function _icon-char($filename) {
$char: "";
@if $filename == home { $char: "\E001"; }
@return $char;
}
@mixin _p-icon-name($filename) {
& { content: _icon-char($filename); }
}
.p-icon--home:before { @include _p-icon-name(home); }
/* 使用中CSS */
.icon{
&:after{
display: block;
content: "";
}
}
.a-icon{
position: relative;
display: inline-block;
width: 32px;
height: 30px;
line-height: 1;
color: inherit;
vertical-align: top;
touch-action: manipulation;
background-color: transparent;
border: none;
appearance: none;
}
.like-icon{
position: relative;
&:after{
background-size: 33px 30px;
width: 33px;
height: 32px;
position: absolute;
right: 0;
top: 0;
}
}
.icon-star{
&:after{
background: url(/assets/img/icon/star-outline-gray.svg) no-repeat;
}
&Fill{
&:after{
background: url(/assets/img/icon/star-outline-yellow.svg) no-repeat;
}
&-wrap{
border: 1px solid #F0DE00;
border-radius: 8px;
min-width: 52px;
height: 52px;
&:after{
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
}
}
&-wrap{
border: 1px solid #D0D0D0;
border-radius: 8px;
min-width: 52px;
height: 52px;
&:after{
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
}
}
.icon-text{
&:after{
background: url(/assets/img/icon/file-text-gray.svg) no-repeat;
background-size: 35px 32px;
}
&Fill{
&:after{
background: url(/assets/img/icon/file-text-yellow.svg) no-repeat;
background-size: 35px 32px;
}
&-wrap{
border: 1px solid #F0DE00;
border-radius: 8px;
min-width: 52px;
height: 52px;
margin-right: 10px;
&:after{
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
}
}
&-wrap{
border: 1px solid #D0D0D0;
border-radius: 8px;
min-width: 52px;
height: 52px;
margin-right: 10px;
pointer-events: none;
&:after{
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
}
}
.icon-search{
position: absolute;
top: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
width: 48px;
height: 61px;
cursor: pointer;
@include pc{
height: 69px;
width: 54px;
}
&:after{
background: url(/assets/img/icon/search-gray.svg) no-repeat;
background-size: cover;
width: 20px;
height: 20px;
margin-top: 13px;
@include pc{
width: 26px;
height: 26px;
}
}
}
.icon-calendar{
position: absolute;
top: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
width: 52px;
height: 60px;
cursor: pointer;
@include pc{
height: 69px;
width: 58px;
}
&:after{
background: url(/assets/img/icon/calendar.svg) no-repeat;
background-size: cover;
width: 23px;
height: 25px;
margin-top: 15px;
}
}