Skip to content

Commit

Permalink
Components: Add global styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
filiphsps committed Nov 17, 2023
1 parent 4666a9f commit 54e7ba4
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 64 deletions.
6 changes: 6 additions & 0 deletions .changeset/witty-nails-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@nordcom/nordstar-heading': patch
'@nordcom/nordstar-system': patch
---

Tweak default theme's values.
16 changes: 11 additions & 5 deletions docs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@/styles/base.css';
import '@/styles/base.scss';

import { NordstarProvider } from '@nordcom/nordstar';
import type { Metadata } from 'next';
import type { Metadata, Viewport } from 'next';
import { Montserrat } from 'next/font/google';

const font = Montserrat({
Expand All @@ -16,12 +16,18 @@ export const metadata: Metadata = {
title: {
default: '',
template: `%s | nordstar Component Library`
},
alternates: {
canonical: 'https://nordstar.nordcom.io/'
}
};

export const viewport: Viewport = {
initialScale: 1,
userScalable: true,
width: 'device-width',
interactiveWidget: 'resizes-visual',
themeColor: '#000000',
colorScheme: 'dark'
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
Expand Down
19 changes: 16 additions & 3 deletions docs/src/app/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@
flex-direction: column;
gap: 1rem;

.title {
max-width: 52rem;
.header {
display: flex;
flex-direction: column;
gap: 0.25rem;
padding-top: calc(var(--layout-section-spacing) * 4);
padding-bottom: calc(var(--layout-section-spacing) * 2);
width: 52rem;
max-width: 100%;
}

.content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-columns: 1fr;
gap: 1rem;

@media (min-width: 950px) {
grid-template-columns: 1fr 1fr 1fr;
}

.block {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
}
}
46 changes: 39 additions & 7 deletions docs/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,57 @@
import { Card, Heading, View } from '@nordcom/nordstar';
import type { Metadata } from 'next';
import styles from './page.module.scss';

export const metadata: Metadata = {
title: 'Nordstar',
alternates: {
canonical: 'https://nordstar.nordcom.io/'
}
};

export default async function IndexPage() {
return (
<View className={styles.container}>
<div className={styles.title}>
<div className={styles.header}>
<Heading>Nordstar</Heading>
<Heading level="h2">
An opinionated component library for building human-centric user interfaces
</Heading>
</div>

<div className={styles.content}>
<Card>
<Heading level="h3">Guides</Heading>
<Card className={styles.block}>
<Heading level="h4" as="p">
Guides
</Heading>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Vitae elementum curabitur vitae nunc. Turpis egestas maecenas
pharetra convallis posuere morbi leo urna. Amet consectetur adipiscing elit ut aliquam purus.
Cursus mattis molestie a iaculis at erat pellentesque adipiscing commodo.
</p>
</Card>
<Card>
<Heading level="h3">Examples</Heading>
<Card className={styles.block}>
<Heading level="h4" as="p">
Examples
</Heading>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Vitae elementum curabitur vitae nunc. Turpis egestas maecenas
pharetra convallis posuere morbi leo urna. Amet consectetur adipiscing elit ut aliquam purus.
Cursus mattis molestie a iaculis at erat pellentesque adipiscing commodo.
</p>
</Card>
<Card>
<Heading level="h3">Documentation</Heading>
<Card className={styles.block}>
<Heading level="h4" as="p">
Documentation
</Heading>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Vitae elementum curabitur vitae nunc. Turpis egestas maecenas
pharetra convallis posuere morbi leo urna. Amet consectetur adipiscing elit ut aliquam purus.
Cursus mattis molestie a iaculis at erat pellentesque adipiscing commodo.
</p>
</Card>
</div>
</View>
Expand Down
21 changes: 0 additions & 21 deletions docs/src/styles/base.css

This file was deleted.

1 change: 1 addition & 0 deletions docs/src/styles/base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"prepare": "husky install",
"dev": "concurrently -i --raw npm:dev:*",
"dev:docs": "turbo dev --filter=@nordcom/nordstar-docs",
"dev:packages": "npm run build:packages && turbo dev --filter=!@nordcom/nordstar-docs --filter=!@nordcom/nordstar-storybook",
"dev:packages": "turbo dev --filter=!@nordcom/nordstar-docs --filter=!@nordcom/nordstar-storybook",
"dev:storybook": "turbo dev --filter=@nordcom/nordstar-storybook",
"build": "turbo build",
"build:docs": "turbo build --filter=@nordcom/nordstar-docs",
Expand Down
27 changes: 21 additions & 6 deletions packages/components/heading/src/heading.module.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.container {
margin: 0;
hyphens: auto;

&:not(:empty):after {
&:not(:empty):is(.h1, .h2):after {
content: '.';
font-size: 0.75em;
line-height: 1;
}

&.h1 {
Expand All @@ -15,14 +13,31 @@
}
&.h2 {
font-weight: 400;
font-size: 2.75rem;
line-height: 1.1;
font-size: 1.85rem;
line-height: 1.075;
letter-spacing: 0.02rem;
text-transform: lowercase;
color: var(--color-foreground-secondary);

@media (min-width: 950px) {
font-size: 2rem;
}
}
&.h3 {
font-size: 1.6rem;
font-weight: 800;
line-height: 1;
text-transform: lowercase;

@media (min-width: 950px) {
font-size: 1.75rem;
}
}
&.h4 {
font-size: 0.9rem;
font-weight: 700;
line-height: 1;
text-transform: uppercase;
color: var(--color-foreground-secondary);
}
}
3 changes: 2 additions & 1 deletion packages/components/view/src/view.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
flex-direction: column;
justify-content: flex-start;
align-items: center;
max-width: 100vw;

.content {
width: calc(100vw - calc(var(--layout-page-spacing) * 2));
max-width: var(--layout-page-width);
max-width: min(var(--layout-page-width), 100%);
margin: var(--layout-page-spacing);
}
}
16 changes: 1 addition & 15 deletions packages/core/system/src/nordstar-provider.module.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
.container {
--block-padding: 1rem;
--block-border-width: 0.1rem;
--block-border-radius: 0.65rem;

--layout-page-width: 1200px;
--layout-page-spacing: 1.25rem;

--color-background: #000000;
--color-background-highlight: #262626;
--color-foreground: #fefefe;
--color-foreground-secondary: #828282;

background: var(--color-background);
color: var(--color-foreground);
font-family: var(--font-primary);
display: contents;
}
1 change: 1 addition & 0 deletions packages/core/system/src/nordstar-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ReactNode } from 'react';
import styles from './nordstar-provider.module.scss';
import './styling.scss';

export type NordstarProviderProps = {
children: ReactNode;
Expand Down
67 changes: 67 additions & 0 deletions packages/core/system/src/styling.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
html,
body {
margin: 0;
padding: 0;
}

body {
width: 100vw;
max-width: 100vw;
background: var(--color-background);
color: var(--color-foreground);
font-family: var(--font-primary);
font-size: 14px;

// Touch actions
touch-action: pan-y;
overscroll-behavior: none auto;

// Deal with font rendering
-moz-osx-font-smoothing: auto;
-webkit-font-smoothing: subpixel-antialiased;
font-smooth: always;
text-rendering: optimizeLegibility;
text-size-adjust: auto;
font-size-adjust: ex-height ch-width from-font;
}

:root {
--block-padding: 1rem;
--block-border-width: 0.1rem;
--block-border-radius: 0.65rem;

--layout-page-width: 1200px;
--layout-page-spacing: 1.25rem;

--layout-section-spacing: 1rem;
--layout-section-padding: 1.75rem;

--color-background: #000000;
--color-background-highlight: #262626;
--color-foreground: #fefefe;
--color-foreground-secondary: #828282;

@media (min-width: 950px) {
--layout-page-spacing: 1.25rem;
}
}

* {
box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
margin: 0;
padding: 0;
line-height: normal;
}

p {
font-size: 0.9rem;
}

1 comment on commit 54e7ba4

@vercel
Copy link

@vercel vercel bot commented on 54e7ba4 Nov 17, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nordstar – ./docs

nordstar-git-master-nordcom.vercel.app
nordstar-nordcom.vercel.app
nordstar.vercel.app
nordstar.nordcom.io

Please sign in to comment.