Last active
September 21, 2017 04:56
-
-
Save sekky0905/af26d51448886c2dd5736a1a17696643 to your computer and use it in GitHub Desktop.
CSSの設計方法をまとめてみた~SUIT CCS編~(Angularによるサンプル付き) ref: http://qiita.com/Sekky0905/items/605d23d8287fd4c160b4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p class="u-floatLeft">hoge</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ComponentName{...} | |
.ComponentName--modifierName{...} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.Compomnent{} | |
.Compomnent.is-stateOfComponent{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component} from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss', './utilities.scss'] | |
}) | |
export class AppComponent { | |
contentsTitle = 'SUIT CSS!'; | |
contentsHeading = 'design principles'; | |
designPrinciples = ['Modularity', 'Cohesion', 'Composition and configuration', 'Loose coupling', 'Soft encapsulation', 'Documentation']; | |
clazz = 'AppComponent is-coloredBlack'; | |
/** | |
* 文字を赤くする | |
*/ | |
changeColorToRed() { | |
this.clazz = 'AppComponent is-coloredRed'; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Component Name--> | |
<article class="AppComponent"> | |
<!--ComponentName-descendentName--> | |
<header class="AppComponent-header"> | |
<h1>{{contentsTitle}}</h1> | |
</header> | |
<!--ComponentName-descendentName--> | |
<div class="AppComponent-content"> | |
<!--ComponentName.is-stateOfComponent--> | |
<h1 [class]="clazz" (click)="changeColorToRed()">{{contentsHeading}}</h1> | |
<!--utilities--> | |
<ul class=" u-listStyleNone"> | |
<li *ngFor="let p of designPrinciples"> | |
{{p}} | |
</li> | |
</ul> | |
</div> | |
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*AppComponentに対するstyle*/ | |
.AppComponent { | |
width: 100%; | |
.AppComponent-header { | |
color: #0000ed; | |
} | |
.AppComponent-content { | |
color: #3A3A3A; | |
} | |
.is-coloredBlack { | |
color: black; | |
} | |
.is-coloredRed { | |
color: red; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "UTF-8"; | |
/*AppComponentに対するstyle*/ | |
.AppComponent { | |
width: 100%; | |
} | |
.AppComponent .AppComponent-header { | |
color: #0000ed; | |
} | |
.AppComponent .AppComponent-content { | |
color: #3A3A3A; | |
} | |
.AppComponent .is-coloredBlack { | |
color: black; | |
} | |
.AppComponent.is-coloredRed { | |
color: red; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*listの点を消す*/ | |
.u-listStyleNone { | |
list-style: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "UTF-8"; | |
/*listの点を消す*/ | |
.u-listStyleNone { | |
list-style: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment