-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(HelperClasses): add breakpoint helper classes (#11786)
* feat(HelperClasses): add breakpoint helper classes * style(HelperClasses): change from class to mixin * style(HelperMixins): renamed to helper mixins, hide-at-breakpoint * docs(Style): updates the utilites section of styles doc * chore(build): add new file to file bundle * test(snapshot): update snapshots Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
aa44d1d
commit 53b6323
Showing
10 changed files
with
165 additions
and
3 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/carbon-components-react/scss/utilities/_hide-at-breakpoint.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,9 @@ | ||
// Code generated by carbon-components-react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 2018 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward '@carbon/styles/scss/utilities/hide-at-breakpoint'; |
9 changes: 9 additions & 0 deletions
9
packages/carbon-components/scss/utilities/_hide-at-breakpoint.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,9 @@ | ||
// Code generated by carbon-components. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 2018 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward '@carbon/styles/scss/utilities/hide-at-breakpoint'; |
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,9 @@ | ||
// Code generated by @carbon/react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 2018 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward '@carbon/styles/scss/utilities/hide-at-breakpoint'; |
21 changes: 21 additions & 0 deletions
21
packages/react/src/components/HideAtBreakpoint/HideAtBreakpoint-story.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,21 @@ | ||
@use '../../../../styles/scss/utilities/hide-at-breakpoint' as *; | ||
|
||
.hide-at-sm { | ||
@include hide-at-sm; | ||
} | ||
|
||
.hide-at-md { | ||
@include hide-at-md; | ||
} | ||
|
||
.hide-at-lg { | ||
@include hide-at-lg; | ||
} | ||
|
||
.hide-at-xlg { | ||
@include hide-at-xlg; | ||
} | ||
|
||
.hide-at-max { | ||
@include hide-at-max; | ||
} |
46 changes: 46 additions & 0 deletions
46
packages/react/src/components/HideAtBreakpoint/HideAtBreakpoint.stories.js
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,46 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2018 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import './HideAtBreakpoint-story.scss'; | ||
import React from 'react'; | ||
|
||
export default { | ||
title: 'Helpers/HideAtBreakpoint', | ||
component: HideAtBreakpoint, | ||
}; | ||
|
||
export const HideAtBreakpoint = () => { | ||
return ( | ||
<> | ||
<div className="hide-at-sm"> | ||
<code>@include hide-at-sm</code> <br /> | ||
<br /> | ||
Only hidden on sm breakpoint | ||
</div> | ||
<div className="hide-at-md"> | ||
<code>@include hide-at-md</code> <br /> | ||
<br /> | ||
Only hidden on md breakpoint | ||
</div> | ||
<div className="hide-at-lg"> | ||
<code>@include hide-at-lg</code> <br /> | ||
<br /> | ||
Only hidden on lg breakpoint | ||
</div> | ||
<div className="hide-at-xlg"> | ||
<code>@include hide-at-xlg</code> <br /> | ||
<br /> | ||
Only hidden on xlg breakpoint | ||
</div> | ||
<div className="hide-at-max"> | ||
<code>@include hide-at-max</code> <br /> | ||
<br /> | ||
Only hidden on max breakpoint | ||
</div> | ||
</> | ||
); | ||
}; |
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
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
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
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,44 @@ | ||
@use '../breakpoint' as *; | ||
@use '../config'; | ||
|
||
// Mixins that can be used to hide elements only at specific breakpoints. | ||
// Helpful for when you would like to hide elements outside of a Grid context | ||
@mixin hide-at-sm { | ||
padding: 2rem 1rem; | ||
background: #8a3ffc; | ||
@include breakpoint-between('sm', 'md') { | ||
display: none; | ||
} | ||
} | ||
|
||
@mixin hide-at-md { | ||
padding: 2rem 1rem; | ||
background: #4589ff; | ||
@include breakpoint-between('md', 'lg') { | ||
display: none; | ||
} | ||
} | ||
|
||
@mixin hide-at-lg { | ||
padding: 2rem 1rem; | ||
background: #42be65; | ||
@include breakpoint-between('lg', 'xlg') { | ||
display: none; | ||
} | ||
} | ||
|
||
@mixin hide-at-xlg { | ||
padding: 2rem 1rem; | ||
background: #f1c21b; | ||
@include breakpoint-between('xlg', 'max') { | ||
display: none; | ||
} | ||
} | ||
|
||
@mixin hide-at-max { | ||
padding: 2rem 1rem; | ||
background: #da1e28; | ||
@include breakpoint-up('max') { | ||
display: 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