Skip to content

Commit

Permalink
docs(grid): updated with API docs and example (#3136)
Browse files Browse the repository at this point in the history
* docs(grid): updated with API docs and example

* docs(grid): better description

* docs(grid): progressive disclosure and helpers
  • Loading branch information
sstrubberg authored Sep 16, 2022
1 parent 835651e commit 00c3c22
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/pages/guidelines/2x-grid/implementation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ guide to start building.
<AnchorLink>Incorporating the shell</AnchorLink>
<AnchorLink>Alignments</AnchorLink>
<AnchorLink>Techniques</AnchorLink>
<AnchorLink>API & Helpers</AnchorLink>
<AnchorLink>Resources</AnchorLink>

</AnchorLinks>
Expand Down Expand Up @@ -1343,6 +1344,39 @@ Image size can change ratios when the breakpoint changes.
</DoDont>
</DoDontRow>

## API & Helpers

There are many ways to make the 2x Grid work for your application using our API.
The example below illustrates removing visibility of a given component based on
the maximum width of the `md` breakpoint.

```css
.component {
display: inline;

/* applies styles inside mixin on md breakpoint or below, like max-width */
@include carbon--breakpoint-down('md') {
display: none;
}
}
```

In addition, you can also use Helpers to control what is being displayed on the
screen at a given breakpoint.

```css
@use '@carbon/styles/scss/utilities/helper-classes';

.my-class {
@include helper-classes.hide-at-sm();
}
```

Checkout the [resources](#resources) section for links to
[the helpers on storybook](https://react.carbondesignsystem.com/?path=/story/helpers-hideatbreakpoint--hide-at-breakpoint)
and the full
[API list on Github](https://github.com/carbon-design-system/carbon/blob/main/packages/grid/docs/sass.md#api).

## Resources

<Row className="resource-card-group">
Expand Down Expand Up @@ -1374,6 +1408,26 @@ Image size can change ratios when the breakpoint changes.

<MdxIcon name="bee" />

</ResourceCard>
</Column>
<Column colMd={4} colLg={4} noGutterSm>
<ResourceCard
subTitle="Carbon grid docs API"
href="https://github.com/carbon-design-system/carbon/blob/main/packages/grid/docs/sass.md#api"
>

<MdxIcon name="github" />

</ResourceCard>
</Column>
<Column colMd={4} colLg={4} noGutterSm>
<ResourceCard
subTitle="Hide at Breakpoint Helpers on Storybook"
href="https://react.carbondesignsystem.com/?path=/story/helpers-hideatbreakpoint--hide-at-breakpoint"
>

<MdxIcon name="storybook" />

</ResourceCard>
</Column>
</Row>

1 comment on commit 00c3c22

@vercel
Copy link

@vercel vercel bot commented on 00c3c22 Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.