New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ITCSS improvements and automatics style guide generation #112
Merged
Merged
Changes from 9 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
5969a6d
Updating ITCSS structure according inuitcss
luboskmetko baeb766
Fixing ITCSS test
luboskmetko 444c36a
Adding sample templates for elements, objects and components
luboskmetko efd0691
Removing sidebar code sample as it's not a good example of component
luboskmetko c5c9701
Adding style guide stying and additional elements
luboskmetko 9dcd3f9
Adding remaining objects
luboskmetko 720a5eb
Adding simple layout system
luboskmetko 099f793
Updating layout object for smaller resolutions
luboskmetko 22f11b4
Fixing spacing unit in spacing utility
luboskmetko 7cda280
Renaming files and test accordingly
luboskmetko 1759b06
Renaming style guide so it's generated as a regular page
luboskmetko 5083ecc
Extending style guide from base layout
luboskmetko a909bac
Renaming component file name to match component name
luboskmetko d285407
Testing creation of new templates
luboskmetko b68f619
Adding style guide to project index
luboskmetko 376cf63
Fixing HTML validation error in images element
luboskmetko ff7701d
Copying Twig templates to WP theme
luboskmetko 0fc3fec
Merging WP base template with front-end one
luboskmetko c28a9d6
Fixing conflicts
luboskmetko 4981e69
Fixing WP test
luboskmetko 78392ec
Fixing remaining WP tests
luboskmetko 716136e
Using revisionePath on styles
luboskmetko a564ae3
Fixing scripts and styles path in base template
luboskmetko a775775
Adding header component
luboskmetko ed9c3fc
Improving footer component styling
luboskmetko 220f133
Removing HTML header (it's in base template now)
luboskmetko 1068b85
Moving to tease templates to components
luboskmetko a105bb8
Moving to tease templates to components
luboskmetko 242ba22
Adding main navigation component
luboskmetko 675736a
Removing sidebar from WP templates
luboskmetko ab3f7c7
Adding comment and comment for components
luboskmetko 6743306
Displaying info about no comments
luboskmetko 96089ae
Adding a note about moderation
luboskmetko 3304822
Adding default WP styles for images
luboskmetko 76e7f7e
Moving styles for WP only components to the WP generator
luboskmetko e3afcfe
Renaming style guide in WP projects so it works as a page
luboskmetko File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
generators/app/templates/styles/itcss/components/_components.buttons.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* ========================================================================== | ||
#BUTTONS | ||
========================================================================== */ | ||
|
||
/** | ||
* This is an example component. Extend inuitcss by building your own components | ||
* that make up your UI. Component classes are prefixed with a `c-`. | ||
*/ | ||
|
||
/** | ||
* 1. Allow us to style box model properties. | ||
* 2. Line different sized buttons up a little nicer. | ||
* 3. Make buttons inherit font styles (often necessary when styling `input`s as | ||
* buttons). | ||
* 4. Reset/normalize some styles. | ||
* 5. Force all button-styled elements to appear clickable. | ||
*/ | ||
|
||
.c-btn { | ||
display: inline-block; /* [1] */ | ||
vertical-align: middle; /* [2] */ | ||
font: inherit; /* [3] */ | ||
text-align: center; /* [4] */ | ||
margin: 0; /* [4] */ | ||
cursor: pointer; /* [5] */ | ||
padding: 0.5rem 1rem; | ||
transition: $global-transition; | ||
border-radius: $global-radius; | ||
} | ||
|
||
/* Style variants | ||
========================================================================== */ | ||
|
||
.c-btn--primary { | ||
background-color: $color-link; | ||
|
||
&, | ||
&:hover, | ||
&:active, | ||
&:focus { | ||
text-decoration: none; /* [4] */ | ||
color: $color-white; | ||
} | ||
|
||
&:hover, | ||
&:focus { | ||
background-color: $color-hover; | ||
} | ||
} | ||
|
||
/* Size variants | ||
========================================================================== */ | ||
|
||
.c-btn--small { | ||
padding: 0.25rem 0.5rem; | ||
} | ||
|
||
.c-btn--large { | ||
padding: 0.75rem 1.5rem; | ||
} |
10 changes: 10 additions & 0 deletions
10
generators/app/templates/styles/itcss/components/_components.footer.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* ========================================================================== | ||
#FOOTER | ||
========================================================================== */ | ||
|
||
.c-footer { | ||
border-top: 1px solid $color-border; | ||
font-size: 0.875rem; | ||
margin-top: 2rem; | ||
padding-top: 0.5em; | ||
} |
55 changes: 55 additions & 0 deletions
55
generators/app/templates/styles/itcss/components/_components.style-guide.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* ========================================================================== | ||
#STYLEGUIDE | ||
========================================================================== */ | ||
|
||
$style-guide-color-medium: #666; | ||
$style-guide-color-light: #999; | ||
$style-guide-color-border: #ccc; | ||
|
||
.c-style-guide__intro { | ||
border: 1px solid $style-guide-color-border; | ||
border-bottom-width: 2px; | ||
border-right-width: 2px; | ||
margin: 2em 0 1em 0; | ||
padding: 2em; | ||
} | ||
|
||
.c-style-guide__title { | ||
color: $style-guide-color-medium; | ||
font-size: 1.25rem; | ||
font-weight: normal; | ||
margin: 0 0 0.25em 0; | ||
text-transform: uppercase; | ||
} | ||
|
||
.c-style-guide__desc { | ||
color: $style-guide-color-medium; | ||
margin: 0; | ||
} | ||
|
||
.c-style-guide__section { | ||
@include clearfix(); | ||
padding: 1rem 0; | ||
} | ||
|
||
.c-style-guide__section-title { | ||
border-bottom: 1px solid $style-guide-color-border; | ||
clear: both; | ||
color: $style-guide-color-medium; | ||
font-size: 1.25rem; | ||
font-weight: normal; | ||
padding-bottom: 0.5em; | ||
text-transform: uppercase; | ||
width: 50%; | ||
} | ||
|
||
.c-style-guide__section-subtitle { | ||
border-left: 6px solid $style-guide-color-border; | ||
clear: both; | ||
color: $style-guide-color-light; | ||
font-size: 1.125rem; | ||
font-weight: normal; | ||
margin: 2em 0; | ||
padding-left: 1em; | ||
text-transform: uppercase; | ||
} |
7 changes: 0 additions & 7 deletions
7
generators/app/templates/styles/itcss/components/_footer.scss
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
generators/app/templates/styles/itcss/components/_layout.scss
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
generators/app/templates/styles/itcss/elements/_elements.headings.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* ========================================================================== | ||
#HEADINGS | ||
========================================================================== */ | ||
|
||
/** | ||
* Simple default styles for headings 1 through 6. Anything more opinionated | ||
* than simple font-size changes should likely be applied via classes (see: | ||
* http://csswizardry.com/2016/02/managing-typography-on-large-apps/). | ||
*/ | ||
|
||
h1 { | ||
font-size: 2.25rem; | ||
} | ||
|
||
h2 { | ||
font-size: 1.75rem; | ||
} | ||
|
||
h3 { | ||
font-size: 1.5rem; | ||
} | ||
|
||
h4 { | ||
font-size: 1.25rem; | ||
} | ||
|
||
h5 { | ||
font-size: 1.125rem; | ||
} | ||
|
||
h6 { | ||
font-size: 1rem; | ||
} |
7 changes: 7 additions & 0 deletions
7
generators/app/templates/styles/itcss/elements/_elements.hr.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* ========================================================================== | ||
#HR | ||
========================================================================== */ | ||
|
||
hr { | ||
display: block; | ||
} |
28 changes: 28 additions & 0 deletions
28
generators/app/templates/styles/itcss/elements/_elements.images.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* ========================================================================== | ||
#IMAGES | ||
========================================================================== */ | ||
|
||
/** | ||
* 1. Fluid images for responsive purposes. | ||
* 2. Offset `alt` text from surrounding copy. | ||
* 3. Setting `vertical-align` removes the whitespace that appears under `img` | ||
* elements when they are dropped into a page as-is. Safer alternative to | ||
* using `display: block;`. | ||
*/ | ||
|
||
img { | ||
font-style: italic; /* [2] */ | ||
max-width: 100%; /* [1] */ | ||
vertical-align: middle; /* [3] */ | ||
} | ||
|
||
|
||
/** | ||
* 1. If a `width` and/or `height` attribute have been explicitly defined, let’s | ||
* not make the image fluid. | ||
*/ | ||
|
||
img[width], /* [1] */ | ||
img[height] { /* [1] */ | ||
max-width: none; | ||
} |
12 changes: 12 additions & 0 deletions
12
generators/app/templates/styles/itcss/elements/_elements.links.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* ========================================================================== | ||
#LINKS | ||
========================================================================== */ | ||
|
||
a { | ||
color: $color-link; | ||
text-decoration: underline; | ||
|
||
&:hover { | ||
color: $color-hover; | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
...mplates/styles/itcss/elements/_lists.scss → ...tyles/itcss/elements/_elements.lists.scss
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
37 changes: 37 additions & 0 deletions
37
generators/app/templates/styles/itcss/elements/_elements.page.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* ========================================================================== | ||
#PAGE | ||
========================================================================== */ | ||
|
||
/** | ||
* Simple page-level setup. | ||
* | ||
* 1. Set the default `font-size` and `line-height` for the entire project. | ||
* 2. Force scrollbars to always be visible to prevent awkward ‘jumps’ when | ||
* navigating between pages that do/do not have enough content to produce | ||
* scrollbars naturally. | ||
* 3. Ensure the page always fills at least the entire height of the viewport. | ||
*/ | ||
|
||
html { | ||
background: $color-bg; | ||
color: $color-text; | ||
font-family: $font-sans-serif; | ||
font-size: 0.8125rem; /* [1] */ /* 13px */ | ||
line-height: 1.5; /* [1] */ | ||
min-height: 100%; /* [3] */ | ||
overflow-y: scroll; /* [2] */ | ||
padding: 1rem; | ||
|
||
@include bp-medium { | ||
font-size: 0.875em; /* 14px */ | ||
} | ||
|
||
@include bp-large { | ||
font-size: 0.9375em; /* 15px */ | ||
} | ||
|
||
@include bp-full { | ||
font-size: 1em; /* 16px */ | ||
} | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
generators/app/templates/styles/itcss/elements/_elements.tables.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* ========================================================================== | ||
#TABLES | ||
========================================================================== */ | ||
|
||
/** | ||
* 1. Ensure tables fill up as much space as possible. | ||
*/ | ||
|
||
table { | ||
width: 100%; /* [1] */ | ||
} |
16 changes: 0 additions & 16 deletions
16
generators/app/templates/styles/itcss/elements/_headings.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
generators/app/templates/styles/itcss/elements/_links.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
generators/app/templates/styles/itcss/generic/_box-sizing.scss
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
generators/app/templates/styles/itcss/generic/_generic.box-sizing.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* ========================================================================== | ||
#BOX-SIZING | ||
========================================================================== */ | ||
|
||
/** | ||
* More sensible default box-sizing: | ||
* css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice | ||
*/ | ||
|
||
html { | ||
box-sizing: border-box; | ||
} | ||
|
||
* { | ||
&, | ||
&:before, | ||
&:after { | ||
box-sizing: inherit; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
generators/app/templates/styles/itcss/generic/_generic.normalize.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* ========================================================================== | ||
#NORMALIZE | ||
========================================================================== */ | ||
|
||
@import 'normalize-scss/sass/normalize/import-now'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's change this to
components/_btn.scss
?I like having the component name corresponding with its filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea