{"componentChunkName":"component---src-pages-tutorial-angular-step-2-mdx","path":"/tutorial/angular/step-2/","result":{"pageContext":{"frontmatter":{"title":"2. Building pages","tabs":["Overview","Step 1","Step 2","Step 3","Step 4","Step 5","Wrapping up"]},"relativePagePath":"/tutorial/angular/step-2.mdx","titleType":"prepend","MdxNode":{"id":"3f50e9c0-4902-5af6-8778-f7b2c36864bc","children":[],"parent":"7b7e1c00-a529-53fd-9c70-a099e2cbca7f","internal":{"content":"---\ntitle: 2. Building pages\ntabs:\n  ['Overview', 'Step 1', 'Step 2', 'Step 3', 'Step 4', 'Step 5', 'Wrapping up']\n---\n\nimport Preview from 'components/Preview';\n\n### Now that we have a base Angular app, it's time to build a few static pages. In this step, we'll become comfortable with the Carbon UI Shell, grid and various Carbon components.\n\n<AnchorLinks>\n\n<AnchorLink>Fork, clone and branch</AnchorLink>\n<AnchorLink>Add grid</AnchorLink>\n<AnchorLink>Add landing page grid</AnchorLink>\n<AnchorLink>Build landing page</AnchorLink>\n<AnchorLink>Style landing page</AnchorLink>\n<AnchorLink>Add repo page grid</AnchorLink>\n<AnchorLink>Build repo page</AnchorLink>\n<AnchorLink>Style repo page</AnchorLink>\n<AnchorLink>Submit pull request</AnchorLink>\n\n</AnchorLinks>\n\n## Preview\n\nA [preview](https://angular-step-3-carbon-tutorial.netlify.com) of what you'll build:\n\n<Preview\n  height=\"400\"\n  title=\"Carbon Angular Tutorial Step 2\"\n  src=\"https://angular-step-3-carbon-tutorial.netlify.com\"\n  frameborder=\"no\"\n  allowtransparency=\"true\"\n  allowfullscreen={true}\n/>\n\n<InlineNotification>\n\n**Note:** If you get lint errors when you copy the code from the snippets, run `ng lint --fix` to fix them.\n\n</InlineNotification>\n\n## Fork, clone and branch\n\nThis tutorial has an accompanying GitHub repository called [carbon-tutorial-angular](https://github.com/carbon-design-system/carbon-tutorial-angular) that we'll use as a starting point for each step. If you haven't forked and cloned that repository yet, and haven't added the upstream remote, go ahead and do so by following the [step 1 instructions](/tutorial/angular/step-1#fork-clone--branch).\n\n### Branch\n\nWith your repository all set up, let's check out the branch for this tutorial step's starting point.\n\n```bash\ngit fetch upstream\ngit checkout -b angular-step-2 upstream/angular-step-2\n```\n\n<InlineNotification>\n\n**Note:** This builds on top of step 1, but be sure to check out the upstream step 2 branch because it includes the static assets required to get through this step.\n\n</InlineNotification>\n\n### Build and start app\n\nInstall the app's dependencies (in case you're starting fresh in your current directory and not continuing from the previous step):\n\n```bash\nnpm install\n```\n\nThen, start the app:\n\n```bash\nnpm start\n```\n\nYou should see something similar to where the [previous step](/tutorial/angular/step-1)) left off.\n\n## Add grid\n\nIn our last step we added our styles, components and icon packages. Now we are going to build the pages with the grid component.\n\nIn `styles.scss`, we need to configure our grid to use 16 columns instead of the default 12 columns. We do this by adding `grid-columns-16: true` in our `$feature-flags`. `$feature-flags` **must** be set before importing from `carbon-components`, otherwise they won't take affect.\n\n<!-- prettier-ignore-start -->\n```css path=src/styles.scss\n$feature-flags: (\n  grid-columns-16: true\n);\n```\n<!-- prettier-ignore-end -->\n\nNext we'll import our Carbon grid component into `home.module.ts` and `landing-page.component.spec.ts`.\n\n```javascript path=src/app/home/landing-page/landing-page.component.spec.ts,src/app/home/home.module.ts\nimport { GridModule } from 'carbon-components-angular';\n...\n@NgModule({\n  ...\n  imports: [GridModule]\n})\n```\n\n## Add landing page grid\n\nLet's add our grid elements to `landing-page.component.html`.\n\nIn order to use the grid, we need to wrap everything in a `<div ibmGrid>`. We can continue to make rows by adding a `<div ibmRow>` inside the grid, as well as make columns within those rows by adding `<div ibmCol [columnNumbers]=\"{'[breakpoint]': [size]}\"`.\n\nOur column sizes are specified by the number of columns they'll be spanning. If we use `[columnNumbers]=\"{'lg': 4}\"`, it means it'll span 4 of the 16 columns. If we use `[columnNumbers]=\"{'lg': 8}\"` it means it'll span 8 of the 16 columns, and so on.\n\nWe've included the designs for this tutorial app in the `design.sketch` file found as a top-level file in the `carbon-tutorial-angular` repository. But, if you don't have Sketch installed and available to inspect the design, we provide screenshots.\n\n![Landing page grid](../shared/step-2/images/landing-layout.png)\n\n<Caption>Landing page grid</Caption>\n\n<InlineNotification>\n\n**Pro tip:** `CTRL-L` toggles the layout in Sketch.\n\n</InlineNotification>\n\nWe'll break this down into three rows. The first row with the gray background doesn't appear to need any columns. The second row with the white background looks like it has two columns of different widths. The third row with the gray background looks like it has four columns of equal width.\n\nWe'll make rows like so:\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmGrid class=\"bx--grid--full-width landing-page\">\n  <div ibmRow class=\"landing-page__banner\">\n    <div ibmCol [columnNumbers]=\"{'lg': 16}\">1</div>\n  </div>\n  <div ibmRow class=\"landing-page__r2\">\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 7}\">7/16</div>\n    <div ibmCol class=\"bx--offset-lg-1\" [columnNumbers]=\"{'md': 4, 'lg': 7}\">\n      8/16\n    </div>\n  </div>\n  <div ibmRow class=\"landing-page__r3\">\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n  </div>\n</div>\n```\n\nWe added a class of `bx--grid--full-width` to the grid container since our rows need to expand the whole page without any margins. We also added some custom classes like `landing-page`, `landing-page__banner`, `landing-page__r2`, etc., which we will use later.\n\nAlso, take notice of the second row. The tab content only covers 7 columns at this large viewport to prevent overly-large line lengths, so we needed to add a 1 column offset `bx--offset-lg-1` to the second column to fill the full 16 columns in the grid. Then, both of those columns have `'md': 4` so they are of equal width at medium-sized viewports.\n\n## Build landing page\n\nWe'll start adding HTML elements and components by row.\n\n### First row\n\nIn our first row we'll need a `Breadcrumb` component. First, let's import the components we need in `home.module.ts` and `landing-page.component.spec.ts`.\n\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimport { BreadcrumbModule, GridModule } from 'carbon-components-angular';\n```\n\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimports: [BreadcrumbModule, GridModule];\n```\n\nWe can now add our component to the first row, along with a header, like so:\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmRow class=\"landing-page__banner\">\n  <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n    <ibm-breadcrumb noTrailingSlash=\"true\">\n      <ibm-breadcrumb-item href=\"/\">\n        Getting started\n      </ibm-breadcrumb-item>\n    </ibm-breadcrumb>\n    <h1 class=\"landing-page__heading\">\n      Design &amp; build with Carbon\n    </h1>\n  </div>\n</div>\n```\n\nYou may notice that the styles look off. Don't worry, we'll fix these later.\n\n### Second row\n\nIn our second row we'll need `Tabs` and `Button` components also in `home.module.ts` and `landing-page.component.spec.ts`. We'll update the `carbon-components-angular` import to:\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimport {\n  BreadcrumbModule,\n  ButtonModule,\n  GridModule,\n  TabsModule,\n} from 'carbon-components-angular';\n```\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimports: [BreadcrumbModule, ButtonModule, GridModule, TabsModule];\n```\n\nNow we need to modify the second row to use the `Tab` component.\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmRow class=\"landing-page__r2\">\n  <div ibmCol class=\"bx--no-gutter\">\n    <ibm-tabs>\n      <ibm-tab heading=\"About\">\n        <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n          <div ibmRow class=\"landing-page__tab-content\">\n            <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 7}\">7/16</div>\n            <div\n              ibmCol\n              class=\"bx--offset-lg-1\"\n              [columnNumbers]=\"{'md': 4, 'lg': 8}\"\n            >\n              8/16\n            </div>\n          </div>\n        </div>\n      </ibm-tab>\n      <ibm-tab heading=\"Design\">\n        <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n          <div ibmRow class=\"landing-page__tab-content\">\n            <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n              Rapidly build beautiful and accessible experiences. The Carbon kit\n              contains all resources you need to get started.\n            </div>\n          </div>\n        </div>\n      </ibm-tab>\n      <ibm-tab heading=\"Develop\">\n        <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n          <div ibmRow class=\"landing-page__tab-content\">\n            <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n              Carbon provides styles and components in Vanilla, React, Angular,\n              and Vue for anyone building on the web.\n            </div>\n          </div>\n        </div>\n      </ibm-tab>\n    </ibm-tabs>\n  </div>\n</div>\n```\n\n<InlineNotification>\n\n**Note:** We're using the grid for the page layout, but we also need to apply the grid within the tab content. When doing so, make sure the nested grid has the expected `grid` > `row` > `col` DOM structure.\n\n</InlineNotification>\n\nHold up! If you were to run [DAP](https://www.ibm.com/able/dynamic-assessment-plug-in.html) to check for accessibility violations, you'd see `Multiple navigation landmarks must have unique labels specified with aria-label or aria-labelledby` because both the `Breadcrumb` and `Tabs` components use `<nav>` elements. To fix, add `ariaLabel` to the `Breadcrumb` opening tag:\n\n<!-- prettier-ignore-start -->\n```html path=src/app/home/landing-page/landing-page.component.html\n<ibm-breadcrumb noTrailingSlash=\"true\" ariaLabel=\"Page navigation\">\n```\n<!-- prettier-ignore-end -->\n\nSame goes for the `Tabs` opening tag:\n\n<!-- prettier-ignore-start -->\n```html\n<ibm-tabs ariaLabel=\"Tab navigation\">\n```\n<!-- prettier-ignore-end -->\n\nNext, we'll need to add a styling override to move the tabs to the right on large viewports, and tidy up the alignment of the grid. Create a file `carbon-overrides.scss` in `src/assets/scss` with this declaration block.\n\n```scss path=src/assets/carbon-overrides.scss\n// makes the grid fit the entire width of the page\n.bx--grid--full-width {\n  padding-left: 1rem;\n  padding-right: 1rem;\n}\n\n// removes excess padding for nested full width grids\n.bx--grid--full-width .bx--grid--full-width {\n  padding-left: 0;\n  padding-right: 0;\n}\n\n// removes extraneous row margins in the full width grid\n.bx--grid--full-width .bx--row {\n  margin-left: 0;\n  margin-right: 0;\n}\n\n// aligns the tabs to the right\n.landing-page__r2 .bx--tabs__nav {\n  right: 0;\n}\n\n// forces the navigation items to be displayed at all viewport sizes\n.bx--header__nav {\n  display: block;\n}\n```\n\nThen in `styles.scss` add this import after the Carbon `styles.scss` import.\n\n<!-- prettier-ignore-start -->\n```scss path=src/styles.scss\n@import './assets/scss/carbon-overrides.scss';\n```\n<!-- prettier-ignore-end -->\n\n<InlineNotification>\n\n**Note:** We don't have to include this in a separate file, but it's nice to keep overrides separate from your application's styling so when migrating to future Carbon versions and if there are breaking changes via different class names, you have a consolidated list of styling declaration blocks to review.\n\n</InlineNotification>\n\nWe can now add our images and text for each column in the first `Tab` in `landing-page.component.html`.\n\n<!-- prettier-ignore-start -->\n```html path=src/app/home/landing-page/landing-page.component.html\n<ibm-tab heading=\"About\">\n  <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n    <div ibmRow class=\"landing-page__tab-content\">\n      <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 7}\">\n        <h2 class=\"landing-page__subheading\">\n          What is Carbon?\n        </h2>\n        <p class=\"landing-page__p\">\n          Carbon is IBM’s open-source design system for digital\n          products and experiences. With the IBM Design Language\n          as its foundation, the system consists of working code,\n          design tools and resources, human interface guidelines,\n          and a vibrant community of contributors.\n        </p>\n        <button ibmButton>Learn more</button>\n      </div>\n      <div ibmCol class=\"bx--offset-lg-1\" [columnNumbers]=\"{'md': 4, 'lg': 8}\">\n        <img\n        class=\"landing-page__illo\"\n        src=\"../../../assets/tab-illo.png\"\n        alt=\"Carbon illustration\"\n        />\n      </div>\n    </div>\n  </div>\n</ibm-tab>\n```\n<!-- prettier-ignore-end -->\n\nNow let's download the image in `src/assests` and set the image size in `landing-page.component.scss`:\n\n```bash\ncurl -o tab-illo.png https://raw.githubusercontent.com/carbon-design-system/carbon-tutorial-vue/vue-step-3/src/assets/tab-illo.png\n```\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__illo {\n  max-width: 100%;\n}\n```\n\nAssuming that the second and third tab would have a similar design, we would set them up in the same way. However, since our design specs don't show those tabs, we'll leave the code as is.\n\n### Third row\n\nThe third row will be created in a later tutorial, so we'll just add the headers for now.\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmRow class=\"landing-page__r3\">\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">\n    <h3 class=\"landing-page__label\">The Principles</h3>\n  </div>\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">Carbon is Open</div>\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">Carbon is Modular</div>\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">Carbon is Consistent</div>\n</div>\n```\n\n## Style landing page\n\nWe've added basic layout styles in `landing-page.component.scss` and `styles.scss`, so now let's add type, color and spacing styles to match the design. We'll be using our [spacing tokens](https://www.carbondesignsystem.com/guidelines/spacing). In `landing-page.component.scss`, add these imports at the **top** of the file so we can use Carbon breakpoints, tokens, and typography Sass mixins and functions:\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n@import '~carbon-components/scss/globals/scss/vendor/@carbon/type/scss/font-family';\n@import '~carbon-components/scss/globals/scss/typography';\n```\n<!-- prettier-ignore-end -->\n\n### Banner\n\n<Row>\n<Column colLg={8}>\n\n![Banner vertical spacing](../shared/step-2/images/landing-r1-spacing.png)\n\n<Caption>Banner vertical spacing</Caption>\n\n</Column>\n</Row>\n\n<InlineNotification>\n\n**Pro tip:** `CTRL-G` toggles the grid in Sketch.\n\n</InlineNotification>\n\nNow, we need to add a space above the breadcrumb and below the heading. For that, add:\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__banner {\n  padding-top: $spacing-05;\n  padding-bottom: $spacing-07 * 4;\n}\n```\n\nReferencing the [spacing token table](https://www.carbondesignsystem.com/guidelines/spacing#spacing-scale), `16px` can be set with the `$spacing-05` token. The design calls for `128px` of space below the heading and that's not in the spacing scale, we can achieve that in Sass by multiplying 32px (`$spacing-07`) by 4. We could use `128px` or `8rem` directly in our styling, but using our tokens preserves consistency should the token values get updated in the future.\n\nLooking at the design, we need a wall-to-wall light gray background behind the banner and also behind the third row. This is a great opportunity to use a Sass mixin. We will put this at the top of `landing-page.component.scss`.\n\nPer the design we need to use Gray 10 for our banner background color, which can be set with the `$ui-01` [color token](https://www.carbondesignsystem.com/guidelines/color/usage). Also, we want the background to extend into the grid's outermost gutters to go the full width of the viewport, so given the DOM structure, we can achieve that by setting the background in an absolutely positioned pseudo element.\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n@mixin landing-page-background() {\n  background-color: $ui-01;\n  position: relative;\n\n  &::before {\n    content: '';\n    position: absolute;\n    left: -$spacing-05;\n    top: 0;\n    right: -$spacing-05;\n    bottom: 0;\n    background: $ui-01;\n    z-index: -1;\n  }\n}\n```\n\nNow to use the new mixin, update the `.landing-page__banner` declaration block to:\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__banner {\n  padding-top: $spacing-05;\n  padding-bottom: $spacing-07 * 4;\n  @include landing-page-background;\n}\n```\n\nNext, we can see that the `h1` is using the `heading-05` type token.\n\n<Row>\n<Column colLg={8}>\n\n![Banner heading type](../shared/step-2/images/landing-r1-type.png)\n\n<Caption>Banner heading type</Caption>\n\n</Column>\n</Row>\n\nThe Sketch symbol naming is consistent with the development Sass tokens to help translate design to development. So, looking up the [type token](https://www.carbondesignsystem.com/guidelines/typography/productive), we know to use `productive-heading-05`:\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__heading {\n  @include carbon--type-style('productive-heading-05');\n}\n```\n<!-- prettier-ignore-end -->\n\n### Row two\n\nFor our second row, we need to fix the tabs vertical positioning to match the design. By inspecting the tabs component, you can see that the tab height computes to `40px`. We can use that to create our negative top margin in rem units.\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__r2 {\n  margin-top: rem(-40px);\n}\n```\n\nWe also need to adjust our vertical spacing and type treatment. Like before, it's a matter of using spacing and type tokens like so:\n\n<Row>\n<Column colLg={8}>\n\n![Row 2 vertical spacing](../shared/step-2/images/landing-r2-spacing.png)\n\n<Caption>Row 2 vertical spacing</Caption>\n\n</Column>\n</Row>\n\n<InlineNotification>\n\n**Note:** You may be wondering why there are vertical gaps between the type and spacers. Each type token has a line height that's suited for its font size. The vertical spacers adjacently touch the line height boundaries and not the baseline, for consistency as well as development ease so `margins` and `paddings` don't need to offset line heights.\n\n</InlineNotification>\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__tab-content {\n  padding-top: $layout-05;\n  padding-bottom: $layout-05;\n}\n\n.landing-page__subheading {\n  @include carbon--type-style('productive-heading-03');\n  @include carbon--font-weight('semibold');\n}\n\n.landing-page__p {\n  @include carbon--type-style('productive-heading-03');\n  margin-top: $spacing-06;\n  margin-bottom: $spacing-08;\n\n  @include carbon--breakpoint-between((320px + 1), md) {\n    max-width: 75%;\n  }\n}\n```\n<!-- prettier-ignore-end -->\n\n### Row three\n\n<Row>\n<Column colLg={8}>\n\n![Row 3 vertical spacing](../shared/step-2/images/landing-r3-spacing.png)\n\n<Caption>Row 3 vertical spacing</Caption>\n\n</Column>\n</Row>\n\nLet's also add some styles for the last row, even though that will get used later in the tutorial. You'll notice that we get to re-use the `landing-page-background` mixin that we just created.\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__r3 {\n  padding-top: $spacing-09;\n  padding-bottom: $spacing-09;\n  @include landing-page-background;\n}\n\n.landing-page__label {\n  @include carbon--type-style('heading-01');\n}\n```\n<!-- prettier-ignore-end -->\n\nTa-da! You should see a finished landing page! Now we can move on to the repo page.\n\n## Add repo page grid\n\nFirst, we’ll add our grid and table by importing a few components in `repositories.module.ts` and `repo-page.component.spec.ts`:\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/repositories/repositories.module.ts,src/app/repositories/repo-page/repo-page.component.spec.ts\nimport { GridModule, TableModule } from 'carbon-components-angular';\n```\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/repositories/repositories.module.ts,src/app/repositories/repo-page/repo-page.component.spec.ts\nimports: [GridModule, TableModule];\n```\n\nNow in our `repo-page.component.html` we will add our grid containers.\n\n```html path=src/app/repositories/repo-page/repo-page.component.html\n<div ibmGrid class=\"bx--grid--full-width bx--grid--no-gutter repo-page\">\n  <div ibmRow class=\"repo-page__r1\">\n    <div ibmCol [columnNumbers]=\"{'lg': 16}\">Data table will go here</div>\n  </div>\n</div>\n```\n\n## Build repo page\n\nWe currently have the `repo-page` that just contains a grid and placeholder content for the time being. In the next tutorial step we're going to be querying an API to populate the `Table` component in this page. As a best practice to separate data fetching from the presentation components, go ahead and create a `repo-table` component as a sibling to `repo-page`.\n\n```bash\nng g component repositories/repo-table --lint-fix\n```\n\n##### Folder structure\n\n```bash\nsrc/app/repositories\n├── repo-table.component.html\n├── repo-table.component.scss\n├── repo-table.component.spec.ts\n└── repo-table.component.ts\n```\n\nNext we will add our newly generated repo-table to the declarations in `repo-page.component.spec.ts`\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/repositories/repo-page/repo-page.component.spec.ts\nimport { RepoTableComponent } from '../repo-table/repo-table.component';\n```\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/repositories/repo-page/repo-page.component.spec.ts\ndeclarations: [ RepoPageComponent, RepoTableComponent ],\n```\n\n### Build data table\n\nThen, let's create the table in `repo-table.component.html`\n\n<!-- prettier-ignore-start -->\n```html path=src/app/repositories/repo-table/repo-table.component.html\n<ibm-table-container>\n\t<ibm-table-header>\n\t\t<h4 ibmTableHeaderTitle>Carbon Repositories</h4>\n\t\t<p ibmTableHeaderDescription>A collection of public Carbon repositories.</p>\n\t</ibm-table-header>\n\t<ibm-table\n\t\t[model]=\"model\"\n\t\t[showSelectionColumn]=\"false\"\n\t\t[striped]=\"false\">\n\t</ibm-table>\n</ibm-table-container>\n```\n<!-- prettier-ignore-end -->\n\nInstead of the usual write-your-own-html approach you had with `<table>`, Carbon table uses the model-view-controller approach.\n\nHere, you create a view (with built-in controller) and provide it a model. Changes you make to the model are reflected in the view.\n\n### Render data table\n\nThen include the following arrays to pass into the `repo-table.component.ts` component. We'll be setting the `rows` array from an API in the next tutorial step, but for now, static example rows will suffice.\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/repositories/repo-table/repo-table.component.ts\nimport { Component, OnInit } from '@angular/core';\n\nimport {\n  TableModel,\n  TableItem,\n  TableHeaderItem,\n} from 'carbon-components-angular';\n\n@Component({\n  selector: 'app-repo-table',\n  templateUrl: './repo-table.component.html',\n  styleUrls: ['./repo-table.component.scss']\n})\nexport class RepoTableComponent implements OnInit {\n  model = new TableModel();\n\n  constructor() {}\n\n  ngOnInit() {\n    this.model.data = [\n      [\n        new TableItem({ data: 'Repo 1', expandedData: 'Row description' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: '123' }),\n        new TableItem({ data: '456' }),\n        new TableItem({ data: 'Links' }),\n      ],\n      [\n        new TableItem({ data: 'Repo 2', expandedData: 'Row description' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: '123' }),\n        new TableItem({ data: '456' }),\n        new TableItem({ data: 'Links' }),\n      ],\n      [\n        new TableItem({ data: 'Repo 3', expandedData: 'Row description' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: '123' }),\n        new TableItem({ data: '456' }),\n        new TableItem({ data: 'Links' }),\n      ],\n    ];\n    this.model.header = [\n      new TableHeaderItem({ data: 'Name' }),\n      new TableHeaderItem({ data: 'Created' }),\n      new TableHeaderItem({ data: 'Updated' }),\n      new TableHeaderItem({ data: 'Open Issues' }),\n      new TableHeaderItem({ data: 'Stars' }),\n      new TableHeaderItem({ data: 'Links' }),\n    ];\n  }\n}\n```\n<!-- prettier-ignore-end -->\n\nAt this point, go to `repo-page.component.html` because now we need to render a static `repo-table`.\n\n```html path=src/app/repositories/repo-page/repo-page.component.html\n<div ibmGrid class=\"bx--grid--full-width bx--grid--no-gutter repo-page\">\n  <div ibmRow class=\"repo-page__r1\">\n    <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n      <app-repo-table></app-repo-table>\n    </div>\n  </div>\n</div>\n```\n\n## Style repo page\n\nOur styles for the repo page are mostly fine. We just need to update a few vertical spacing issues.\n\nIn `repo-page.component.scss`, add the following styles:\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/repositories/repo-page/repo-page.component.scss\n@import '~carbon-components/scss/globals/scss/typography';\n\n.repo-page .bx--row {\n  padding-top: $spacing-05;\n  padding-bottom: $spacing-05;\n}\n```\n<!-- prettier-ignore-end -->\n\nCongratulations! We've now created our static repo page!\n\n## Submit pull request\n\nWe're going to submit a pull request to verify completion of this tutorial step.\n\n### Continuous integration (CI) check\n\nRun the `lint` and `test` scripts to make sure we're all set to submit a pull request.\n\n```bash\nng lint --fix\nnpm run lint && npm test\n```\n\n<InlineNotification>\n\n**Note:** Having issues running this? [Step 1](</tutorial/angular/step-1#continuous-integration-(ci)-check>) has troubleshooting notes that may help.\n\n</InlineNotification>\n\n### Git commit and push\n\nBefore we can create a pull request, stage and commit all of your changes:\n\n```bash\ngit add --all && git commit -m \"feat(tutorial): complete step 2\"\n```\n\nThen, push to your repository:\n\n```bash\ngit push origin angular-step-2\n```\n\n<InlineNotification>\n\n**Note:** Having issues pushing your changes? [Step 1](/tutorial/angular/step-1#git-commit-and-push) has troubleshooting notes that may help.\n\n</InlineNotification>\n\n### Pull request (PR)\n\nFinally, visit [carbon-tutorial-angular](https://github.com/carbon-design-system/carbon-tutorial-angular) to \"Compare & pull request\". In doing so, make sure that you are comparing to `angular-step-2` into `base: angular-step-2`.\n\n<InlineNotification>\n\n**Note:** Expect your tutorial step PRs to be reviewed by the Carbon team but not merged. We'll close your PR so we can keep the repository's remote branches pristine and ready for the next person!\n\n</InlineNotification>\n","type":"Mdx","contentDigest":"1c7f468efb367ec96cbf70adbfa9d1ac","counter":1675,"owner":"gatsby-plugin-mdx"},"frontmatter":{"title":"2. Building pages","tabs":["Overview","Step 1","Step 2","Step 3","Step 4","Step 5","Wrapping up"]},"exports":{},"rawBody":"---\ntitle: 2. Building pages\ntabs:\n  ['Overview', 'Step 1', 'Step 2', 'Step 3', 'Step 4', 'Step 5', 'Wrapping up']\n---\n\nimport Preview from 'components/Preview';\n\n### Now that we have a base Angular app, it's time to build a few static pages. In this step, we'll become comfortable with the Carbon UI Shell, grid and various Carbon components.\n\n<AnchorLinks>\n\n<AnchorLink>Fork, clone and branch</AnchorLink>\n<AnchorLink>Add grid</AnchorLink>\n<AnchorLink>Add landing page grid</AnchorLink>\n<AnchorLink>Build landing page</AnchorLink>\n<AnchorLink>Style landing page</AnchorLink>\n<AnchorLink>Add repo page grid</AnchorLink>\n<AnchorLink>Build repo page</AnchorLink>\n<AnchorLink>Style repo page</AnchorLink>\n<AnchorLink>Submit pull request</AnchorLink>\n\n</AnchorLinks>\n\n## Preview\n\nA [preview](https://angular-step-3-carbon-tutorial.netlify.com) of what you'll build:\n\n<Preview\n  height=\"400\"\n  title=\"Carbon Angular Tutorial Step 2\"\n  src=\"https://angular-step-3-carbon-tutorial.netlify.com\"\n  frameborder=\"no\"\n  allowtransparency=\"true\"\n  allowfullscreen={true}\n/>\n\n<InlineNotification>\n\n**Note:** If you get lint errors when you copy the code from the snippets, run `ng lint --fix` to fix them.\n\n</InlineNotification>\n\n## Fork, clone and branch\n\nThis tutorial has an accompanying GitHub repository called [carbon-tutorial-angular](https://github.com/carbon-design-system/carbon-tutorial-angular) that we'll use as a starting point for each step. If you haven't forked and cloned that repository yet, and haven't added the upstream remote, go ahead and do so by following the [step 1 instructions](/tutorial/angular/step-1#fork-clone--branch).\n\n### Branch\n\nWith your repository all set up, let's check out the branch for this tutorial step's starting point.\n\n```bash\ngit fetch upstream\ngit checkout -b angular-step-2 upstream/angular-step-2\n```\n\n<InlineNotification>\n\n**Note:** This builds on top of step 1, but be sure to check out the upstream step 2 branch because it includes the static assets required to get through this step.\n\n</InlineNotification>\n\n### Build and start app\n\nInstall the app's dependencies (in case you're starting fresh in your current directory and not continuing from the previous step):\n\n```bash\nnpm install\n```\n\nThen, start the app:\n\n```bash\nnpm start\n```\n\nYou should see something similar to where the [previous step](/tutorial/angular/step-1)) left off.\n\n## Add grid\n\nIn our last step we added our styles, components and icon packages. Now we are going to build the pages with the grid component.\n\nIn `styles.scss`, we need to configure our grid to use 16 columns instead of the default 12 columns. We do this by adding `grid-columns-16: true` in our `$feature-flags`. `$feature-flags` **must** be set before importing from `carbon-components`, otherwise they won't take affect.\n\n<!-- prettier-ignore-start -->\n```css path=src/styles.scss\n$feature-flags: (\n  grid-columns-16: true\n);\n```\n<!-- prettier-ignore-end -->\n\nNext we'll import our Carbon grid component into `home.module.ts` and `landing-page.component.spec.ts`.\n\n```javascript path=src/app/home/landing-page/landing-page.component.spec.ts,src/app/home/home.module.ts\nimport { GridModule } from 'carbon-components-angular';\n...\n@NgModule({\n  ...\n  imports: [GridModule]\n})\n```\n\n## Add landing page grid\n\nLet's add our grid elements to `landing-page.component.html`.\n\nIn order to use the grid, we need to wrap everything in a `<div ibmGrid>`. We can continue to make rows by adding a `<div ibmRow>` inside the grid, as well as make columns within those rows by adding `<div ibmCol [columnNumbers]=\"{'[breakpoint]': [size]}\"`.\n\nOur column sizes are specified by the number of columns they'll be spanning. If we use `[columnNumbers]=\"{'lg': 4}\"`, it means it'll span 4 of the 16 columns. If we use `[columnNumbers]=\"{'lg': 8}\"` it means it'll span 8 of the 16 columns, and so on.\n\nWe've included the designs for this tutorial app in the `design.sketch` file found as a top-level file in the `carbon-tutorial-angular` repository. But, if you don't have Sketch installed and available to inspect the design, we provide screenshots.\n\n![Landing page grid](../shared/step-2/images/landing-layout.png)\n\n<Caption>Landing page grid</Caption>\n\n<InlineNotification>\n\n**Pro tip:** `CTRL-L` toggles the layout in Sketch.\n\n</InlineNotification>\n\nWe'll break this down into three rows. The first row with the gray background doesn't appear to need any columns. The second row with the white background looks like it has two columns of different widths. The third row with the gray background looks like it has four columns of equal width.\n\nWe'll make rows like so:\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmGrid class=\"bx--grid--full-width landing-page\">\n  <div ibmRow class=\"landing-page__banner\">\n    <div ibmCol [columnNumbers]=\"{'lg': 16}\">1</div>\n  </div>\n  <div ibmRow class=\"landing-page__r2\">\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 7}\">7/16</div>\n    <div ibmCol class=\"bx--offset-lg-1\" [columnNumbers]=\"{'md': 4, 'lg': 7}\">\n      8/16\n    </div>\n  </div>\n  <div ibmRow class=\"landing-page__r3\">\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n    <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">1/4</div>\n  </div>\n</div>\n```\n\nWe added a class of `bx--grid--full-width` to the grid container since our rows need to expand the whole page without any margins. We also added some custom classes like `landing-page`, `landing-page__banner`, `landing-page__r2`, etc., which we will use later.\n\nAlso, take notice of the second row. The tab content only covers 7 columns at this large viewport to prevent overly-large line lengths, so we needed to add a 1 column offset `bx--offset-lg-1` to the second column to fill the full 16 columns in the grid. Then, both of those columns have `'md': 4` so they are of equal width at medium-sized viewports.\n\n## Build landing page\n\nWe'll start adding HTML elements and components by row.\n\n### First row\n\nIn our first row we'll need a `Breadcrumb` component. First, let's import the components we need in `home.module.ts` and `landing-page.component.spec.ts`.\n\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimport { BreadcrumbModule, GridModule } from 'carbon-components-angular';\n```\n\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimports: [BreadcrumbModule, GridModule];\n```\n\nWe can now add our component to the first row, along with a header, like so:\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmRow class=\"landing-page__banner\">\n  <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n    <ibm-breadcrumb noTrailingSlash=\"true\">\n      <ibm-breadcrumb-item href=\"/\">\n        Getting started\n      </ibm-breadcrumb-item>\n    </ibm-breadcrumb>\n    <h1 class=\"landing-page__heading\">\n      Design &amp; build with Carbon\n    </h1>\n  </div>\n</div>\n```\n\nYou may notice that the styles look off. Don't worry, we'll fix these later.\n\n### Second row\n\nIn our second row we'll need `Tabs` and `Button` components also in `home.module.ts` and `landing-page.component.spec.ts`. We'll update the `carbon-components-angular` import to:\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimport {\n  BreadcrumbModule,\n  ButtonModule,\n  GridModule,\n  TabsModule,\n} from 'carbon-components-angular';\n```\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/home/home.module.ts,src/app/home/landing-page/landing-page.component.spec.ts\nimports: [BreadcrumbModule, ButtonModule, GridModule, TabsModule];\n```\n\nNow we need to modify the second row to use the `Tab` component.\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmRow class=\"landing-page__r2\">\n  <div ibmCol class=\"bx--no-gutter\">\n    <ibm-tabs>\n      <ibm-tab heading=\"About\">\n        <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n          <div ibmRow class=\"landing-page__tab-content\">\n            <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 7}\">7/16</div>\n            <div\n              ibmCol\n              class=\"bx--offset-lg-1\"\n              [columnNumbers]=\"{'md': 4, 'lg': 8}\"\n            >\n              8/16\n            </div>\n          </div>\n        </div>\n      </ibm-tab>\n      <ibm-tab heading=\"Design\">\n        <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n          <div ibmRow class=\"landing-page__tab-content\">\n            <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n              Rapidly build beautiful and accessible experiences. The Carbon kit\n              contains all resources you need to get started.\n            </div>\n          </div>\n        </div>\n      </ibm-tab>\n      <ibm-tab heading=\"Develop\">\n        <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n          <div ibmRow class=\"landing-page__tab-content\">\n            <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n              Carbon provides styles and components in Vanilla, React, Angular,\n              and Vue for anyone building on the web.\n            </div>\n          </div>\n        </div>\n      </ibm-tab>\n    </ibm-tabs>\n  </div>\n</div>\n```\n\n<InlineNotification>\n\n**Note:** We're using the grid for the page layout, but we also need to apply the grid within the tab content. When doing so, make sure the nested grid has the expected `grid` > `row` > `col` DOM structure.\n\n</InlineNotification>\n\nHold up! If you were to run [DAP](https://www.ibm.com/able/dynamic-assessment-plug-in.html) to check for accessibility violations, you'd see `Multiple navigation landmarks must have unique labels specified with aria-label or aria-labelledby` because both the `Breadcrumb` and `Tabs` components use `<nav>` elements. To fix, add `ariaLabel` to the `Breadcrumb` opening tag:\n\n<!-- prettier-ignore-start -->\n```html path=src/app/home/landing-page/landing-page.component.html\n<ibm-breadcrumb noTrailingSlash=\"true\" ariaLabel=\"Page navigation\">\n```\n<!-- prettier-ignore-end -->\n\nSame goes for the `Tabs` opening tag:\n\n<!-- prettier-ignore-start -->\n```html\n<ibm-tabs ariaLabel=\"Tab navigation\">\n```\n<!-- prettier-ignore-end -->\n\nNext, we'll need to add a styling override to move the tabs to the right on large viewports, and tidy up the alignment of the grid. Create a file `carbon-overrides.scss` in `src/assets/scss` with this declaration block.\n\n```scss path=src/assets/carbon-overrides.scss\n// makes the grid fit the entire width of the page\n.bx--grid--full-width {\n  padding-left: 1rem;\n  padding-right: 1rem;\n}\n\n// removes excess padding for nested full width grids\n.bx--grid--full-width .bx--grid--full-width {\n  padding-left: 0;\n  padding-right: 0;\n}\n\n// removes extraneous row margins in the full width grid\n.bx--grid--full-width .bx--row {\n  margin-left: 0;\n  margin-right: 0;\n}\n\n// aligns the tabs to the right\n.landing-page__r2 .bx--tabs__nav {\n  right: 0;\n}\n\n// forces the navigation items to be displayed at all viewport sizes\n.bx--header__nav {\n  display: block;\n}\n```\n\nThen in `styles.scss` add this import after the Carbon `styles.scss` import.\n\n<!-- prettier-ignore-start -->\n```scss path=src/styles.scss\n@import './assets/scss/carbon-overrides.scss';\n```\n<!-- prettier-ignore-end -->\n\n<InlineNotification>\n\n**Note:** We don't have to include this in a separate file, but it's nice to keep overrides separate from your application's styling so when migrating to future Carbon versions and if there are breaking changes via different class names, you have a consolidated list of styling declaration blocks to review.\n\n</InlineNotification>\n\nWe can now add our images and text for each column in the first `Tab` in `landing-page.component.html`.\n\n<!-- prettier-ignore-start -->\n```html path=src/app/home/landing-page/landing-page.component.html\n<ibm-tab heading=\"About\">\n  <div ibmGrid class=\"bx--grid--no-gutter bx--grid--full-width\">\n    <div ibmRow class=\"landing-page__tab-content\">\n      <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 7}\">\n        <h2 class=\"landing-page__subheading\">\n          What is Carbon?\n        </h2>\n        <p class=\"landing-page__p\">\n          Carbon is IBM’s open-source design system for digital\n          products and experiences. With the IBM Design Language\n          as its foundation, the system consists of working code,\n          design tools and resources, human interface guidelines,\n          and a vibrant community of contributors.\n        </p>\n        <button ibmButton>Learn more</button>\n      </div>\n      <div ibmCol class=\"bx--offset-lg-1\" [columnNumbers]=\"{'md': 4, 'lg': 8}\">\n        <img\n        class=\"landing-page__illo\"\n        src=\"../../../assets/tab-illo.png\"\n        alt=\"Carbon illustration\"\n        />\n      </div>\n    </div>\n  </div>\n</ibm-tab>\n```\n<!-- prettier-ignore-end -->\n\nNow let's download the image in `src/assests` and set the image size in `landing-page.component.scss`:\n\n```bash\ncurl -o tab-illo.png https://raw.githubusercontent.com/carbon-design-system/carbon-tutorial-vue/vue-step-3/src/assets/tab-illo.png\n```\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__illo {\n  max-width: 100%;\n}\n```\n\nAssuming that the second and third tab would have a similar design, we would set them up in the same way. However, since our design specs don't show those tabs, we'll leave the code as is.\n\n### Third row\n\nThe third row will be created in a later tutorial, so we'll just add the headers for now.\n\n```html path=src/app/home/landing-page/landing-page.component.html\n<div ibmRow class=\"landing-page__r3\">\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">\n    <h3 class=\"landing-page__label\">The Principles</h3>\n  </div>\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">Carbon is Open</div>\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">Carbon is Modular</div>\n  <div ibmCol [columnNumbers]=\"{'md': 4, 'lg': 4}\">Carbon is Consistent</div>\n</div>\n```\n\n## Style landing page\n\nWe've added basic layout styles in `landing-page.component.scss` and `styles.scss`, so now let's add type, color and spacing styles to match the design. We'll be using our [spacing tokens](https://www.carbondesignsystem.com/guidelines/spacing). In `landing-page.component.scss`, add these imports at the **top** of the file so we can use Carbon breakpoints, tokens, and typography Sass mixins and functions:\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n@import '~carbon-components/scss/globals/scss/vendor/@carbon/type/scss/font-family';\n@import '~carbon-components/scss/globals/scss/typography';\n```\n<!-- prettier-ignore-end -->\n\n### Banner\n\n<Row>\n<Column colLg={8}>\n\n![Banner vertical spacing](../shared/step-2/images/landing-r1-spacing.png)\n\n<Caption>Banner vertical spacing</Caption>\n\n</Column>\n</Row>\n\n<InlineNotification>\n\n**Pro tip:** `CTRL-G` toggles the grid in Sketch.\n\n</InlineNotification>\n\nNow, we need to add a space above the breadcrumb and below the heading. For that, add:\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__banner {\n  padding-top: $spacing-05;\n  padding-bottom: $spacing-07 * 4;\n}\n```\n\nReferencing the [spacing token table](https://www.carbondesignsystem.com/guidelines/spacing#spacing-scale), `16px` can be set with the `$spacing-05` token. The design calls for `128px` of space below the heading and that's not in the spacing scale, we can achieve that in Sass by multiplying 32px (`$spacing-07`) by 4. We could use `128px` or `8rem` directly in our styling, but using our tokens preserves consistency should the token values get updated in the future.\n\nLooking at the design, we need a wall-to-wall light gray background behind the banner and also behind the third row. This is a great opportunity to use a Sass mixin. We will put this at the top of `landing-page.component.scss`.\n\nPer the design we need to use Gray 10 for our banner background color, which can be set with the `$ui-01` [color token](https://www.carbondesignsystem.com/guidelines/color/usage). Also, we want the background to extend into the grid's outermost gutters to go the full width of the viewport, so given the DOM structure, we can achieve that by setting the background in an absolutely positioned pseudo element.\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n@mixin landing-page-background() {\n  background-color: $ui-01;\n  position: relative;\n\n  &::before {\n    content: '';\n    position: absolute;\n    left: -$spacing-05;\n    top: 0;\n    right: -$spacing-05;\n    bottom: 0;\n    background: $ui-01;\n    z-index: -1;\n  }\n}\n```\n\nNow to use the new mixin, update the `.landing-page__banner` declaration block to:\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__banner {\n  padding-top: $spacing-05;\n  padding-bottom: $spacing-07 * 4;\n  @include landing-page-background;\n}\n```\n\nNext, we can see that the `h1` is using the `heading-05` type token.\n\n<Row>\n<Column colLg={8}>\n\n![Banner heading type](../shared/step-2/images/landing-r1-type.png)\n\n<Caption>Banner heading type</Caption>\n\n</Column>\n</Row>\n\nThe Sketch symbol naming is consistent with the development Sass tokens to help translate design to development. So, looking up the [type token](https://www.carbondesignsystem.com/guidelines/typography/productive), we know to use `productive-heading-05`:\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__heading {\n  @include carbon--type-style('productive-heading-05');\n}\n```\n<!-- prettier-ignore-end -->\n\n### Row two\n\nFor our second row, we need to fix the tabs vertical positioning to match the design. By inspecting the tabs component, you can see that the tab height computes to `40px`. We can use that to create our negative top margin in rem units.\n\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__r2 {\n  margin-top: rem(-40px);\n}\n```\n\nWe also need to adjust our vertical spacing and type treatment. Like before, it's a matter of using spacing and type tokens like so:\n\n<Row>\n<Column colLg={8}>\n\n![Row 2 vertical spacing](../shared/step-2/images/landing-r2-spacing.png)\n\n<Caption>Row 2 vertical spacing</Caption>\n\n</Column>\n</Row>\n\n<InlineNotification>\n\n**Note:** You may be wondering why there are vertical gaps between the type and spacers. Each type token has a line height that's suited for its font size. The vertical spacers adjacently touch the line height boundaries and not the baseline, for consistency as well as development ease so `margins` and `paddings` don't need to offset line heights.\n\n</InlineNotification>\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__tab-content {\n  padding-top: $layout-05;\n  padding-bottom: $layout-05;\n}\n\n.landing-page__subheading {\n  @include carbon--type-style('productive-heading-03');\n  @include carbon--font-weight('semibold');\n}\n\n.landing-page__p {\n  @include carbon--type-style('productive-heading-03');\n  margin-top: $spacing-06;\n  margin-bottom: $spacing-08;\n\n  @include carbon--breakpoint-between((320px + 1), md) {\n    max-width: 75%;\n  }\n}\n```\n<!-- prettier-ignore-end -->\n\n### Row three\n\n<Row>\n<Column colLg={8}>\n\n![Row 3 vertical spacing](../shared/step-2/images/landing-r3-spacing.png)\n\n<Caption>Row 3 vertical spacing</Caption>\n\n</Column>\n</Row>\n\nLet's also add some styles for the last row, even though that will get used later in the tutorial. You'll notice that we get to re-use the `landing-page-background` mixin that we just created.\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/home/landing-page/landing-page.component.scss\n.landing-page__r3 {\n  padding-top: $spacing-09;\n  padding-bottom: $spacing-09;\n  @include landing-page-background;\n}\n\n.landing-page__label {\n  @include carbon--type-style('heading-01');\n}\n```\n<!-- prettier-ignore-end -->\n\nTa-da! You should see a finished landing page! Now we can move on to the repo page.\n\n## Add repo page grid\n\nFirst, we’ll add our grid and table by importing a few components in `repositories.module.ts` and `repo-page.component.spec.ts`:\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/repositories/repositories.module.ts,src/app/repositories/repo-page/repo-page.component.spec.ts\nimport { GridModule, TableModule } from 'carbon-components-angular';\n```\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/repositories/repositories.module.ts,src/app/repositories/repo-page/repo-page.component.spec.ts\nimports: [GridModule, TableModule];\n```\n\nNow in our `repo-page.component.html` we will add our grid containers.\n\n```html path=src/app/repositories/repo-page/repo-page.component.html\n<div ibmGrid class=\"bx--grid--full-width bx--grid--no-gutter repo-page\">\n  <div ibmRow class=\"repo-page__r1\">\n    <div ibmCol [columnNumbers]=\"{'lg': 16}\">Data table will go here</div>\n  </div>\n</div>\n```\n\n## Build repo page\n\nWe currently have the `repo-page` that just contains a grid and placeholder content for the time being. In the next tutorial step we're going to be querying an API to populate the `Table` component in this page. As a best practice to separate data fetching from the presentation components, go ahead and create a `repo-table` component as a sibling to `repo-page`.\n\n```bash\nng g component repositories/repo-table --lint-fix\n```\n\n##### Folder structure\n\n```bash\nsrc/app/repositories\n├── repo-table.component.html\n├── repo-table.component.scss\n├── repo-table.component.spec.ts\n└── repo-table.component.ts\n```\n\nNext we will add our newly generated repo-table to the declarations in `repo-page.component.spec.ts`\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/repositories/repo-page/repo-page.component.spec.ts\nimport { RepoTableComponent } from '../repo-table/repo-table.component';\n```\n<!-- prettier-ignore-end -->\n\n```javascript path=src/app/repositories/repo-page/repo-page.component.spec.ts\ndeclarations: [ RepoPageComponent, RepoTableComponent ],\n```\n\n### Build data table\n\nThen, let's create the table in `repo-table.component.html`\n\n<!-- prettier-ignore-start -->\n```html path=src/app/repositories/repo-table/repo-table.component.html\n<ibm-table-container>\n\t<ibm-table-header>\n\t\t<h4 ibmTableHeaderTitle>Carbon Repositories</h4>\n\t\t<p ibmTableHeaderDescription>A collection of public Carbon repositories.</p>\n\t</ibm-table-header>\n\t<ibm-table\n\t\t[model]=\"model\"\n\t\t[showSelectionColumn]=\"false\"\n\t\t[striped]=\"false\">\n\t</ibm-table>\n</ibm-table-container>\n```\n<!-- prettier-ignore-end -->\n\nInstead of the usual write-your-own-html approach you had with `<table>`, Carbon table uses the model-view-controller approach.\n\nHere, you create a view (with built-in controller) and provide it a model. Changes you make to the model are reflected in the view.\n\n### Render data table\n\nThen include the following arrays to pass into the `repo-table.component.ts` component. We'll be setting the `rows` array from an API in the next tutorial step, but for now, static example rows will suffice.\n\n<!-- prettier-ignore-start -->\n```javascript path=src/app/repositories/repo-table/repo-table.component.ts\nimport { Component, OnInit } from '@angular/core';\n\nimport {\n  TableModel,\n  TableItem,\n  TableHeaderItem,\n} from 'carbon-components-angular';\n\n@Component({\n  selector: 'app-repo-table',\n  templateUrl: './repo-table.component.html',\n  styleUrls: ['./repo-table.component.scss']\n})\nexport class RepoTableComponent implements OnInit {\n  model = new TableModel();\n\n  constructor() {}\n\n  ngOnInit() {\n    this.model.data = [\n      [\n        new TableItem({ data: 'Repo 1', expandedData: 'Row description' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: '123' }),\n        new TableItem({ data: '456' }),\n        new TableItem({ data: 'Links' }),\n      ],\n      [\n        new TableItem({ data: 'Repo 2', expandedData: 'Row description' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: '123' }),\n        new TableItem({ data: '456' }),\n        new TableItem({ data: 'Links' }),\n      ],\n      [\n        new TableItem({ data: 'Repo 3', expandedData: 'Row description' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: 'Date' }),\n        new TableItem({ data: '123' }),\n        new TableItem({ data: '456' }),\n        new TableItem({ data: 'Links' }),\n      ],\n    ];\n    this.model.header = [\n      new TableHeaderItem({ data: 'Name' }),\n      new TableHeaderItem({ data: 'Created' }),\n      new TableHeaderItem({ data: 'Updated' }),\n      new TableHeaderItem({ data: 'Open Issues' }),\n      new TableHeaderItem({ data: 'Stars' }),\n      new TableHeaderItem({ data: 'Links' }),\n    ];\n  }\n}\n```\n<!-- prettier-ignore-end -->\n\nAt this point, go to `repo-page.component.html` because now we need to render a static `repo-table`.\n\n```html path=src/app/repositories/repo-page/repo-page.component.html\n<div ibmGrid class=\"bx--grid--full-width bx--grid--no-gutter repo-page\">\n  <div ibmRow class=\"repo-page__r1\">\n    <div ibmCol [columnNumbers]=\"{'lg': 16}\">\n      <app-repo-table></app-repo-table>\n    </div>\n  </div>\n</div>\n```\n\n## Style repo page\n\nOur styles for the repo page are mostly fine. We just need to update a few vertical spacing issues.\n\nIn `repo-page.component.scss`, add the following styles:\n\n<!-- prettier-ignore-start -->\n```scss path=src/app/repositories/repo-page/repo-page.component.scss\n@import '~carbon-components/scss/globals/scss/typography';\n\n.repo-page .bx--row {\n  padding-top: $spacing-05;\n  padding-bottom: $spacing-05;\n}\n```\n<!-- prettier-ignore-end -->\n\nCongratulations! We've now created our static repo page!\n\n## Submit pull request\n\nWe're going to submit a pull request to verify completion of this tutorial step.\n\n### Continuous integration (CI) check\n\nRun the `lint` and `test` scripts to make sure we're all set to submit a pull request.\n\n```bash\nng lint --fix\nnpm run lint && npm test\n```\n\n<InlineNotification>\n\n**Note:** Having issues running this? [Step 1](</tutorial/angular/step-1#continuous-integration-(ci)-check>) has troubleshooting notes that may help.\n\n</InlineNotification>\n\n### Git commit and push\n\nBefore we can create a pull request, stage and commit all of your changes:\n\n```bash\ngit add --all && git commit -m \"feat(tutorial): complete step 2\"\n```\n\nThen, push to your repository:\n\n```bash\ngit push origin angular-step-2\n```\n\n<InlineNotification>\n\n**Note:** Having issues pushing your changes? [Step 1](/tutorial/angular/step-1#git-commit-and-push) has troubleshooting notes that may help.\n\n</InlineNotification>\n\n### Pull request (PR)\n\nFinally, visit [carbon-tutorial-angular](https://github.com/carbon-design-system/carbon-tutorial-angular) to \"Compare & pull request\". In doing so, make sure that you are comparing to `angular-step-2` into `base: angular-step-2`.\n\n<InlineNotification>\n\n**Note:** Expect your tutorial step PRs to be reviewed by the Carbon team but not merged. We'll close your PR so we can keep the repository's remote branches pristine and ready for the next person!\n\n</InlineNotification>\n","fileAbsolutePath":"/zeit/512c25b6/src/pages/tutorial/angular/step-2.mdx"}}}}