Skip to content

Commit c199dd0

Browse files
Merge pull request #1062 from Financial-Times/ui-foundations-base-styles
merge n-ui-foundations into dotcom-ui-base-styles
2 parents bd984a1 + 95d5232 commit c199dd0

File tree

8 files changed

+210
-0
lines changed

8 files changed

+210
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Primitives
2+
@import 'grid/main';
3+
@import 'typography/main';
4+
@import 'util/main';
5+
@import '@financial-times/o-icons/main';
6+
@import '@financial-times/o-colors/main';
7+
@import '@financial-times/o-normalise/main';
8+
@import '@financial-times/o-visual-effects/main';
9+
10+
@mixin nUiFoundations {
11+
@include oNormalise;
12+
@include nUiGrid;
13+
@include nUiTypography;
14+
@include nUiUtil;
15+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@mixin _nUiGridOffsetRules($layout, $mode, $columns) {
2+
@if $mode == offset {
3+
@include oGridOffset($columns);
4+
} @else if $mode == pull {
5+
@include oGridPull($columns);
6+
} @else if $mode == push {
7+
@include oGridPush($columns);
8+
}
9+
}
10+
11+
/// Grid column offset
12+
/// @param {Null|String} $layout-name - S to XL or null
13+
/// @param {Number} $columns - 1 to 12
14+
/// @param {String} $mode - offset, push or pull
15+
@mixin nUiGridOffset($layout-name: null, $columns: 1, $mode: offset) {
16+
$selector: $mode + $columns;
17+
18+
@if $layout-name {
19+
$selector: $layout-name + $selector;
20+
}
21+
22+
[data-o-grid-colspan~="#{$selector}"] {
23+
@if $layout-name {
24+
@include oGridRespondTo($layout-name) {
25+
@include _nUiGridOffsetRules($layout-name, $mode, $columns);
26+
}
27+
} @else {
28+
@include _nUiGridOffsetRules($layout-name, $mode, $columns);
29+
}
30+
}
31+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@import '@financial-times/o-grid/main';
2+
@import 'mixins';
3+
4+
@mixin nUiGrid {
5+
@include oGrid($opts: (
6+
'bleed': true,
7+
'snappy': true,
8+
'shuffle-selectors': false,
9+
'friendly-selectors': false,
10+
'surface': ('current-layout'),
11+
'rows': ('compact')
12+
));
13+
14+
// We have disabled "friendly selectors" but output this one as it's useful
15+
[data-o-grid-colspan~="center"] {
16+
@include oGridCenter();
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
3+
This includes all the basic Origami styles and mixins you can
4+
expect to be available when a page uses n-ui
5+
6+
*/
7+
8+
@import 'mixins';
9+
10+
$n-ui-foundations-is-silent: false !default; // 'silent' means don't apply styles
11+
$n-ui-foundations-applied: false !default;
12+
13+
@if $n-ui-foundations-applied == false and $n-ui-foundations-is-silent == false {
14+
$n-ui-foundations-applied: true;
15+
@include nUiFoundations;
16+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@import '@financial-times/o-fonts/main';
2+
@import '@financial-times/o-typography/main';
3+
4+
@mixin nUiTypography {
5+
@include oFonts($opts: (
6+
'financier-display': (
7+
('weight': 'regular', 'style': 'normal'),
8+
('weight': 'bold', 'style': 'normal'),
9+
('weight': 'medium', 'style': 'normal'),
10+
),
11+
'metric': (
12+
('weight': 'regular', 'style': 'normal'),
13+
('weight': 'semibold', 'style': 'normal'),
14+
)
15+
));
16+
17+
a {
18+
@include oTypographyLink();
19+
}
20+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# n-ui-foundations utilities
2+
3+
Utility HTML classes for FT.com.
4+
5+
## Usage
6+
7+
### Sass
8+
9+
This module is bundled by default and cannot be configured.
10+
11+
### HTML
12+
13+
#### Layout
14+
15+
#### Display
16+
17+
##### `.n-ui-hide`
18+
19+
Hide an element.
20+
21+
##### `.n-ui-hide@screen`
22+
23+
Hide an element for screens.
24+
25+
##### `.n-ui-hide@print`
26+
27+
Hide an element for print.
28+
29+
##### `.n-ui-hide-enhanced`
30+
31+
Hide an element in the enhanced experience.
32+
33+
##### `.n-ui-hide-core`
34+
35+
Hide an element in the core experience.
36+
37+
#### o-normalise
38+
39+
All of [o-normalise’s helpers](https://github.com/Financial-Times/o-normalise/blob/v1.4.2/main.scss#L12) are included in the output of nUiUtil.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
////
2+
/// @group n-ui-foundations mixins
3+
////
4+
5+
/// Basis of n-ui z-indexes
6+
/// @type Number
7+
$n-ui-z-index-basis: 100;
8+
9+
/// Ordered list of z-indexes use cases
10+
/// @type List
11+
$n-ui-z-index-order: (
12+
'welcome',
13+
'meganav',
14+
'sticky-header',
15+
'drawer',
16+
'typeahead',
17+
'overlay',
18+
'notification'
19+
);
20+
21+
@mixin nUiZIndexFor($use-case) {
22+
// scss-lint:disable ImportantRule
23+
$index: index($n-ui-z-index-order, $use-case);
24+
25+
@if $index {
26+
z-index: $n-ui-z-index-basis + $index !important;
27+
} @else {
28+
@warn 'z-index for use case "#{$use-case}" not found.';
29+
}
30+
// scss-lint:enable ImportantRule
31+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@import '@financial-times/o-normalise/main';
2+
@import 'mixins';
3+
4+
//BREAKING CHANGE: .n-ui-clearfix -> .o-normalise-clearfix
5+
//BREAKING CHANGE: .n-ui-visually-hidden -> .o-normalise-visually-hidden
6+
//BREAKING CHANGE: Any remaining instances of n-util- -> n-ui-
7+
8+
@mixin nUiUtil {
9+
10+
//
11+
// Display
12+
//
13+
.n-ui-hide {
14+
display: none;
15+
}
16+
17+
@media screen {
18+
/* stylelint-disable */
19+
.n-ui-hide\@screen {
20+
/* stylelint-enable */
21+
display: none;
22+
}
23+
24+
}
25+
26+
@media print {
27+
/* stylelint-disable */
28+
.n-ui-hide\@print {
29+
/* stylelint-enable */
30+
display: none;
31+
}
32+
}
33+
34+
.no-js .n-ui-hide-no-js,
35+
.js .n-ui-hide-js,
36+
.core .n-ui-hide-core,
37+
.enhanced .n-ui-hide-enhanced {
38+
display: none;
39+
}
40+
}

0 commit comments

Comments
 (0)