|
34 | 34 | ///
|
35 | 35 | /// Creates a grid row class with a standardised margin.
|
36 | 36 | ///
|
37 |
| -/// @param {String} $class [govuk-grid-row] CSS class name |
| 37 | +/// @param {String} $class [nhsuk-grid-row] CSS class name |
38 | 38 | ///
|
39 | 39 | /// @example scss - Default
|
40 | 40 | /// @include govuk-grid-row;
|
|
47 | 47 | @mixin nhsuk-grid-row($class: "nhsuk-grid-row") {
|
48 | 48 | .#{$class} {
|
49 | 49 | @include clearfix;
|
50 |
| - margin-left: -($nhsuk-gutter-half); |
51 | 50 | margin-right: -($nhsuk-gutter-half);
|
| 51 | + margin-left: -($nhsuk-gutter-half); |
52 | 52 | }
|
53 | 53 | }
|
54 | 54 |
|
|
63 | 63 |
|
64 | 64 | /// Generate grid column styles
|
65 | 65 | ///
|
66 |
| -/// Creates a cross browser grid column with a class of '.govuk-grid-column' by |
67 |
| -/// default, and a standardised gutter between the columns. |
| 66 | +/// Creates a grid column with standard gutter between the columns. |
68 | 67 | ///
|
69 |
| -/// Common widths are predefined above as keywords in the `$grid-widths` map. |
| 68 | +/// If a `$class` is provided (which is the default, but deprecated behaviour), |
| 69 | +/// the generated rules will be wrapped in a predefined selector in the format |
| 70 | +/// `$class-$width` (e.g. `nhsuk-grid-column-full`). This behaviour is |
| 71 | +/// deprecated and will be removed in v10.0 |
70 | 72 | ///
|
71 |
| -/// By default their width changes from 100% to specified width at the 'tablet' |
72 |
| -/// breakpoint, but that can be configured to be any other breakpoint by using |
73 |
| -/// the `$at` parameter. |
| 73 | +/// Grid widths are defined in the `$nhsuk-grid-widths` map. |
74 | 74 | ///
|
75 |
| -/// @param {String} $class [govuk-grid-column] CSS class name |
76 |
| -/// @param {String} $width [full] one-quarter | one-third | one-half | two-third | three-quarters | full |
| 75 | +/// By default the column width changes from 100% to specified width at the |
| 76 | +/// 'tablet' breakpoint, but other breakpoints can be specified using the `$at` |
| 77 | +/// parameter. |
| 78 | +/// |
| 79 | +/// @param {String} $width [full] name of a grid width from $nhsuk-grid-widths |
77 | 80 | /// @param {String} $float [left] left | right
|
78 |
| -/// @param {String} $at [tablet] - mobile | tablet | desktop | any custom breakpoint in px or em |
| 81 | +/// @param {String} $at [tablet] - mobile | tablet | desktop | any custom breakpoint |
| 82 | +/// @param {String} $class [nhsuk-grid-column] CSS class name (deprecated) |
79 | 83 | ///
|
80 | 84 | /// @example scss - Default
|
81 |
| -/// @include govuk-grid-column(two-thirds) |
82 |
| -/// |
83 |
| -/// @example scss - Customising the class name |
84 |
| -/// @include govuk-grid-column(one-half, $class: "test-column"); |
| 85 | +/// .nhsuk-grid-column-two-thirds { |
| 86 | +/// @include nhsuk-grid-column(two-thirds, $class: false) |
| 87 | +/// } |
85 | 88 | ///
|
86 | 89 | /// @example scss - Customising the breakpoint where width percentage is applied
|
87 |
| -/// @include govuk-grid-column(one-half, $at: desktop); |
| 90 | +/// .nhsuk-grid-column-one-half-at-desktop { |
| 91 | +/// @include nhsuk-grid-column(one-half, $at: desktop); |
| 92 | +/// } |
88 | 93 | ///
|
89 | 94 | /// @example scss - Customising the float direction
|
90 |
| -/// @include govuk-grid-column(one-half, $float: right); |
| 95 | +/// .nhsuk-grid-column-one-half-right { |
| 96 | +/// @include nhsuk-grid-column(two-thirds, $float: right, $class: false); |
| 97 | +/// } |
| 98 | +/// |
| 99 | +/// @example scss - Customising the class name (deprecated) |
| 100 | +/// @include nhsuk-grid-column(one-half, $class: "test-column"); |
| 101 | +/// |
| 102 | +/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service) |
91 | 103 |
|
92 |
| -@mixin govuk-grid-column($width: full, $float: left, $at: desktop, $class: "nhsuk-grid-column") { |
93 |
| - .#{$class}-#{$width} { |
| 104 | +@mixin nhsuk-grid-column($width: full, $float: left, $at: tablet, $class: "nhsuk-grid-column") { |
| 105 | + @if $class { |
| 106 | + .#{$class}-#{$width} { |
| 107 | + @include nhsuk-grid-column($width, $float, $at, $class: false); |
| 108 | + } |
| 109 | + } @else { |
94 | 110 | box-sizing: border-box;
|
95 |
| - padding: 0 $nhsuk-gutter-half; |
96 | 111 | @if $at != desktop {
|
97 | 112 | width: 100%;
|
98 | 113 | }
|
| 114 | + padding: 0 $nhsuk-gutter-half; |
99 | 115 | @include nhsuk-media-query($from: $at) {
|
100 | 116 | width: nhsuk-grid-width($width);
|
101 | 117 | float: $float;
|
102 | 118 | }
|
103 | 119 | }
|
104 | 120 | }
|
| 121 | + |
| 122 | +/// Generate grid column styles (deprecated) |
| 123 | +/// |
| 124 | +/// @alias nhsuk-grid-column |
| 125 | +/// @deprecated To be removed in v10.0 |
| 126 | + |
| 127 | +@mixin govuk-grid-column($args...) { |
| 128 | + @include nhsuk-grid-column($args...); |
| 129 | +} |
0 commit comments