Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tutorial): complete step 4 / nothing changed. Followed word-by-word ;-) #235

Open
wants to merge 1 commit into
base: v11-next-step-4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
git branch v11-next-step-1

git checkout v11-next-step-1
M README.md
M README.md
Switched to branch 'v11-next-step-1'

git branch v11-next-step-2
Expand Down
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {};

module.exports = nextConfig
module.exports = nextConfig;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"format:diff": "prettier --list-different \"**/*.{js,md,scss}\""
},
"dependencies": {
"@carbon/pictograms-react": "^11.65.0",
"@carbon/react": "^1.35.0",
"@octokit/core": "4.2.0",
"eslint": "8.44.0",
Expand Down Expand Up @@ -68,5 +69,6 @@
"printWidth": 80,
"singleQuote": true,
"trailingComma": "es5"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
4 changes: 2 additions & 2 deletions src/app/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use '@carbon/react/scss/breakpoint' as *;

@use '@/components/TutorialHeader/tutorial-header';

@use '@/components/Info/info';
@use '@/app/home/landing-page';
@use '@/app/repos/repo-page';

Expand All @@ -21,7 +21,7 @@
.cds--content {
margin-top: 3rem;
padding: 0;
// background: var(--cds-background);
// background: var(--cds-background);
}

.cds--content .cds--css-grid {
Expand Down
2 changes: 1 addition & 1 deletion src/app/home/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
@mixin landing-page-background() {
background-color: $layer-01;
position: relative;
}
}
2 changes: 1 addition & 1 deletion src/app/home/_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
.cds--subgrid--wide {
//fix needed to keep the subgrid from scrolling horizontally
margin-right: 1rem;
}
}
56 changes: 25 additions & 31 deletions src/app/home/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
'use client';

import { InfoSection, InfoCard } from '@/components/Info/Info';

import {
Advocate,
Globe,
AcceleratingTransformation,
} from '@carbon/pictograms-react';

import {
Breadcrumb,
BreadcrumbItem,
Expand Down Expand Up @@ -96,37 +104,23 @@ export default function LandingPage() {
</TabPanel>
</TabPanels>
</Tabs>
</Column>
<Column lg={16} md={8} sm={4} className="landing-page__r3">
<Grid>
<Column lg={4} md={2} sm={4}>
<h3 className="landing-page__label">The Principles</h3>
</Column>
<Column
lg={{ start: 5, span: 3 }}
md={{ start: 3, span: 6 }}
sm={4}
className="landing-page__title"
>
Carbon is Open
</Column>
<Column
lg={{ start: 9, span: 3 }}
md={{ start: 3, span: 6 }}
sm={4}
className="landing-page__title"
>
Carbon is Modular
</Column>
<Column
lg={{ start: 13, span: 3 }}
md={{ start: 3, span: 6 }}
sm={4}
className="landing-page__title"
>
Carbon is Consistent
</Column>
</Grid>
<InfoSection heading="The Principles">
<InfoCard
heading="Carbon is Open"
body="It's a distributed effort, guided by the principles of the open-source movement. Carbon's users are also it's makers, and everyone is encouraged to contribute."
icon={() => <Advocate size={32} />}
/>
<InfoCard
heading="Carbon is Modular"
body="Carbon's modularity ensures maximum flexibility in execution. It's components are designed to work seamlessly with each other, in whichever combination suits the needs of the user."
icon={() => <AcceleratingTransformation size={32} />}
/>
<InfoCard
heading="Carbon is Consistent"
body="Based on the comprehensive IBM Design Language, every element and component of Carbon was designed from the ground up to work elegantly together to ensure consistent, cohesive user experiences."
icon={() => <Globe size={32} />}
/>
</InfoSection>
</Column>
</Grid>
);
Expand Down
6 changes: 3 additions & 3 deletions src/app/layout.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import './globals.scss'
import './globals.scss';

import { Providers } from './providers';

export const metadata = {
title: 'Carbon + Next13',
description: 'IBM Carbon Tutorial with NextJS 13',
}
};

export default function RootLayout({ children }) {
return (
Expand All @@ -14,5 +14,5 @@ export default function RootLayout({ children }) {
<Providers>{children}</Providers>
</body>
</html>
)
);
}
4 changes: 2 additions & 2 deletions src/app/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import LandingPage from './home/page';

export default function Page() {
return <LandingPage />;
}
return <LandingPage />;
}
2 changes: 1 addition & 1 deletion src/app/repos/_repo-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
.repo-page__r1 {
padding-top: $spacing-05;
padding-bottom: $spacing-05;
}
}
34 changes: 34 additions & 0 deletions src/components/Info/Info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Grid, Column } from '@carbon/react';

// Take in a phrase and separate the third word in an array
function createArrayFromPhrase(phrase) {
const splitPhrase = phrase.split(' ');
const thirdWord = splitPhrase.pop();
return [splitPhrase.join(' '), thirdWord];
}

const InfoSection = (props) => (
<Grid className={`${props.className} info-section`}>
<Column md={8} lg={16} xlg={3}>
<h3 className="info-section__heading">{props.heading}</h3>
</Column>
{props.children}
</Grid>
);

const InfoCard = (props) => {
const splitHeading = createArrayFromPhrase(props.heading);

return (
<Column sm={4} md={8} lg={4} className="info-card">
<h4 className="info-card__heading">
{`${splitHeading[0]} `}
<strong>{splitHeading[1]}</strong>
</h4>
<p className="info-card__body">{props.body}</p>
{props.icon()}
</Column>
);
};

export { InfoSection, InfoCard };
87 changes: 87 additions & 0 deletions src/components/Info/_info.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@use '@carbon/react/scss/type' as *;

@use '@carbon/react/scss/spacing' as *;
@use '@carbon/react/scss/breakpoint' as *;
@use '@carbon/react/scss/theme' as *;

.info-section__heading {
@include type-style('heading-01');
padding-bottom: $spacing-08;
}

.info-card__heading {
@include type-style('productive-heading-03');
}

.info-card__body {
margin-top: $spacing-06;
flex-grow: 1; // fill space so pictograms are bottom aligned
@include type-style('body-long-01');

// prevent large line lengths between small and medium viewports
@include breakpoint-between(321px, md) {
max-width: 75%;
}
}

.info-card {
margin-top: $spacing-09;
display: flex;
flex-direction: column;
padding-left: 1rem;

svg {
margin-top: $spacing-09;
}

@include breakpoint(sm) {
padding-left: 0;
}

div {
flex-grow: 1; // fill space so icons are bottom aligned
}

// top border in only small breakpoints to prevent overrides
@include breakpoint-down(lg) {
padding-left: 0;
margin-top: 0;
flex-direction: row-reverse;

&:not(:nth-child(2)) {
padding-top: $spacing-10;
}

svg {
margin-top: -0.25rem;
margin-right: 2rem;
min-width: 48px;
min-height: 48px;
}
}

@include breakpoint(lg) {
margin-top: 0;
padding-left: 0;

&:not(:nth-child(2)) {
border-left: 1px solid $border-subtle-01;
padding-left: 1rem;
}

svg {
margin-top: $spacing-12;
}
}

// left border in all items
@include breakpoint(xlg) {
margin-top: 0;
border-left: 1px solid $border-subtle-01;
padding-left: 1rem;

svg {
margin-top: $spacing-12;
}
}
}
8 changes: 4 additions & 4 deletions src/components/TutorialHeader/TutorialHeader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client";
'use client';

import {
Header,
Expand All @@ -13,10 +13,10 @@ import {
SideNav,
SideNavItems,
HeaderSideNavItems,
} from "@carbon/react";
import { Switcher, Notification, UserAvatar } from "@carbon/icons-react";
} from '@carbon/react';
import { Switcher, Notification, UserAvatar } from '@carbon/icons-react';

import Link from "next/link";
import Link from 'next/link';

const TutorialHeader = () => (
<HeaderContainer
Expand Down
2 changes: 1 addition & 1 deletion src/components/TutorialHeader/_tutorial-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
.action-icons {
display: none;
}
}
}
Loading