Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Consistent scope and naming for variables, mixins, and keyframes #887

Merged
merged 22 commits into from
Jan 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3b244b0
Rename icon web font and move name to variable
Dec 31, 2016
ea4ddfa
Scope all animation keyframes
Dec 31, 2016
86232df
Scope all mixins
Dec 31, 2016
628bc15
Revert "Rename icon web font and move name to variable"
Dec 31, 2016
f87aec6
Remove the utility prefix from all directionality mixins
Jan 3, 2017
9c88b9e
Renamed all directionality mixins to camelcase without extra dashes
Jan 3, 2017
7d5f535
Rename mixins to match naming convention (camelcase, all together)
Jan 3, 2017
a4b9886
Change BrandIcon modifiers to lowercase
Jan 3, 2017
6f84071
Add “brandIcon” scope to all brand icon variables
Jan 3, 2017
151f3ef
Rename font system and family base variables
Jan 3, 2017
fd7a388
Prefix all animation variables
Jan 3, 2017
f4a485d
Rename all responsive screen variables to change order of size and mi…
Jan 3, 2017
0062d98
Rename font system and font family base variables
Jan 3, 2017
15b7f8f
Rename brand icon mixins to match other mixins
Jan 3, 2017
c102640
Update documentation with new mixin and variable names
Jan 3, 2017
31b7a2f
Merge branch 'master' into miwhea/consistent-names
Jan 4, 2017
7d43f02
Merge branch 'master' into miwhea/consistent-names
Jan 4, 2017
4b23344
Another pass at standardizing mixins and variables as kebab-case (unl…
Jan 4, 2017
12967c9
Add documentation page for code conventions, starting with naming con…
Jan 5, 2017
2c4deee
Small update to naming conventions document
Jan 6, 2017
3ef8acc
Fix typo in naming conventions document
Jan 6, 2017
bd4b408
Fix conventions documentation
Jan 6, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ghdocs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ When creating a pull request, please describe in detail the problem you are solv
### Feature requests
Please be sure to open an issue before starting a hefty PR so we can let you know if we're likely to consider your request--and to make sure we aren't already planning on doing the work.

### Naming conventions
See the [code conventions](https://github.com/OfficeDev/office-ui-fabric-core/blob/master/ghdocs/CONVENTIONS.md) for details on what to name CSS classes, animation keyframes, variables, and mixins.

### Contribution license agreement
For pull requests affecting fewer than 15 lines of code, you will need to sign a [Contribution License Agreement (CLA)](https://cla.microsoft.com/) before your contribution can be incorporated. To complete the CLA, you will need to submit the request via the form and then electronically sign the CLA when you receive the email containing the link to the document.

Expand Down
22 changes: 22 additions & 0 deletions ghdocs/CONVENTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Code conventions

## Naming
When naming classes, animation keyframes, variables, and mixins, please follow these conventions:

- Everything in the global scope is prefixed with "ms-".
- CSS classes follow [SUIT CSS conventions](https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md).
- `ms-Grid-col`
- `ms-Icon--Airplane`
- _Exception: Pascal case is used for the icon names:_ `ms-Icon--EraseTool`
- Animation keyframes all match their corresponding CSS class.
- `@keyframes ms-slideRightIn10`
- Variables are kebab case.
- `$ms-animation-duration-3`
- `$ms-screen-min-xl`
- _Exception: camel case is used for colors to match class names:_ `$ms-color-themeLighterAlt`
- Mixins are usually kebab case.
- `ms-focus-border()`
- `ms-drop-shadow()`
- _Exception: If the mixin maps directly to a CSS class, we match the class name:_
- `ms-u-borderBox()` outputs to `.ms-u-borderBox`
- `ms-fontSize-s()` outputs to `.ms-fontSize-s`
12 changes: 6 additions & 6 deletions src/documentation/sass/_AnimationsSection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $animationExample-height: 90px;
display: none;
}

@media(min-width: $ms-screen-md-min) {
@media(min-width: $ms-screen-min-md) {
display: block;
.docs-animationExampleColumn {
display: block;
Expand Down Expand Up @@ -36,7 +36,7 @@ $animationExample-height: 90px;
margin-bottom: 14px;
}

@media(min-width: $ms-screen-lg-min) {
@media(min-width: $ms-screen-min-lg) {
.docs-animationDescriptionColumn {
margin-bottom: 0;
}
Expand All @@ -48,7 +48,7 @@ $animationExample-height: 90px;
}
}

@media(min-width: $ms-screen-xl-min) {
@media(min-width: $ms-screen-min-xl) {

.docs-animationCubicColumn {
display: block;
Expand All @@ -70,19 +70,19 @@ $animationExample-height: 90px;
min-height: 30px;

.mobileText {
@include ms-baseFont;
@include ms-base-font;
font-weight: $ms-font-weight-semibold;
}

@media(min-width: $ms-screen-md-min) {
@media(min-width: $ms-screen-min-md) {
line-height: 18px;
vertical-align: middle;
.mobileText {
display: none;
}
}

@media(min-width: $ms-screen-xl-min) {
@media(min-width: $ms-screen-min-xl) {
min-height: $animationExample-height;
line-height: $animationExample-height;
}
Expand Down
8 changes: 4 additions & 4 deletions src/documentation/sass/_ColorBoxes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ms-InfoBarHeight: 30px;
margin: 0;
}
.mobileText {
@include ms-baseFont;
@include ms-base-font;
font-weight: $ms-font-weight-semibold;
}
}
Expand All @@ -31,7 +31,7 @@ $ms-InfoBarHeight: 30px;
line-height: 14px;
}

@media (min-width: $ms-screen-lg-min) {
@media (min-width: $ms-screen-min-lg) {

span.ms-font-size-m {
font-size: $ms-font-size-m;
Expand All @@ -43,7 +43,7 @@ $ms-InfoBarHeight: 30px;
.docs-colorBox.ms-u-lg4 {
line-height: 7px;

@media (min-width: $ms-screen-lg-min) {
@media (min-width: $ms-screen-min-lg) {
width: 32.333333%;
margin-right: 1%;
}
Expand All @@ -57,7 +57,7 @@ $ms-InfoBarHeight: 30px;
padding-top:12px;
}

@media (min-width: $ms-screen-lg-min) {
@media (min-width: $ms-screen-min-lg) {
.docs-colorBox {
width: 32.333333%;
font-size: $ms-font-size-m;
Expand Down
4 changes: 2 additions & 2 deletions src/documentation/sass/_IconsSection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
list-style: none !important;

// Phone, Phablet
@media (min-width: $ms-screen-lg-min) {
@media (min-width: $ms-screen-min-lg) {
width: 24%;
}

@media (min-width: $ms-screen-xl-min) {
@media (min-width: $ms-screen-min-xl) {
margin-right: 1%;
margin-bottom: 1%;
min-height: 124px;
Expand Down
2 changes: 1 addition & 1 deletion src/documentation/sass/_LeftNav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}

&.is-selected {
@include ms-baseFont;
@include ms-base-font;
font-weight: $ms-font-weight-semibold;
color: $ms-color-black;
border-left-width: 2px;
Expand Down
2 changes: 1 addition & 1 deletion src/documentation/sass/_TypographySection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
}

@media(min-width: $ms-screen-lg-min) {
@media(min-width: $ms-screen-min-lg) {
.docs-HelperHeader {
display: block;
}
Expand Down
12 changes: 6 additions & 6 deletions src/documentation/sass/base/_Typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,42 @@ h4 {

h1 {
color: $ms-color-neutralSecondary;
font-family: $ms-font-system-base;
font-family: $ms-font-base-system;
font-size: $ms-font-size-su;
font-weight: $ms-font-weight-light;
}

h2 {
font-family: $ms-font-system-base;
font-family: $ms-font-base-system;
font-weight: $ms-font-weight-semilight;
font-size: $ms-font-size-xxl;
color: $ms-color-neutralPrimary;
}

h3 {
font-family: $ms-font-system-base;
font-family: $ms-font-base-system;
font-weight: $ms-font-weight-regular;
font-size: $ms-font-size-xl;
color: $ms-color-neutralDark !important; // @todo: Remove this important when dev.office.com styles no longer leak
}

h4 {
font-family: $ms-font-system-base;
font-family: $ms-font-base-system;
font-weight: $ms-font-weight-semibold;
font-size: $ms-font-size-l;
color: $ms-color-neutralPrimary;
}

p {
font-family: $ms-font-system-base;
font-family: $ms-font-base-system;
font-weight: $ms-font-weight-regular;
font-size: $ms-font-size-l;
color: $ms-color-neutralPrimary;
margin-bottom: 20px;
line-height: 1.5;

strong {
font-family: $ms-font-system-base;
font-family: $ms-font-base-system;
font-weight: normal;
font-weight: $ms-font-weight-semibold;
}
Expand Down
2 changes: 1 addition & 1 deletion src/documentation/sass/components/_Table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
width: 100%;

th {
@include ms-baseFont;
@include ms-base-font;
font-size: 14px;
font-weight: $ms-font-weight-regular;
padding: 10px;
Expand Down
8 changes: 4 additions & 4 deletions src/documentation/sass/docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ $high-contrast-green: #3ff23f;

// slideRightIn80
@mixin ms-u-slideRightIn80 {
@include ms-animation((fadeIn, slideRightIn80), $ms-duration3, $ms-ease1);
@include ms-animation((fadeIn, slideRightIn80), $ms-animation-duration-3, $ms-animation-ease-1);
}
.ms-u-slideRightIn80 {
@include ms-u-slideRightIn80;
Expand All @@ -85,7 +85,7 @@ $high-contrast-green: #3ff23f;

// slideLeftIn80
@mixin ms-u-slideLeftIn80 {
@include ms-animation((fadeIn, slideLeftIn80), $ms-duration3, $ms-ease1);
@include ms-animation((fadeIn, slideLeftIn80), $ms-animation-duration-3, $ms-animation-ease-1);
}
.ms-u-slideLeftIn80 {
@include ms-u-slideLeftIn80;
Expand All @@ -102,7 +102,7 @@ $high-contrast-green: #3ff23f;

// slideLeftIn80
@mixin ms-u-slideLeftOut80 {
@include ms-animation((fadeOut, slideLeftOut80), $ms-duration3, $ms-ease1);
@include ms-animation((fadeOut, slideLeftOut80), $ms-animation-duration-3, $ms-animation-ease-1);
}
.ms-u-slideLeftOut80 {
@include ms-u-slideLeftOut80;
Expand All @@ -119,7 +119,7 @@ $high-contrast-green: #3ff23f;

// slideLeftIn80
@mixin ms-u-slideRightOut80 {
@include ms-animation((fadeOut, slideRightOut80), $ms-duration3, $ms-ease1);
@include ms-animation((fadeOut, slideRightOut80), $ms-animation-duration-3, $ms-animation-ease-1);
}
.ms-u-slideRightOut80 {
@include ms-u-slideRightOut80;
Expand Down
2 changes: 1 addition & 1 deletion src/documentation/sass/layouts/_Page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $docs-sideNavWidths: 300px;
}

// On larger screens, show and position the navs
@media (min-width: $ms-screen-xl-min) {
@media (min-width: $ms-screen-min-xl) {
.docs-Page.has-leftNav {
padding-left: $docs-sideNavWidths + 30px;

Expand Down
10 changes: 5 additions & 5 deletions src/sass/_BrandIcon.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project root for license information.

@include brandIconClasses(1);
@include brandIconSizesClasses();
@include ms-brand-icon-classes(1);
@include ms-brand-icon-size-classes();

// Pixel Ratio 1.5
@media only screen and (min-resolution: 144dpi) {
@include brandIconClasses(1_5);
@include ms-brand-icon-classes(1_5);
}

// Pixel Ratio 2
@media only screen and (min-resolution: 192dpi) {
@include brandIconClasses(2);
@include ms-brand-icon-classes(2);
}

// Pixel Ratio 3
@media only screen and (min-resolution: 288dpi) {
@include brandIconClasses(3);
@include ms-brand-icon-classes(3);
}
Loading