Skip to content

Commit

Permalink
feat: add anker docs and change naming of anker helper classes
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jan 11, 2019
1 parent d52f9e2 commit 4a6f3f3
Show file tree
Hide file tree
Showing 40 changed files with 430 additions and 391 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Syntax = () => (
<>
<h5>Fedra Sans Book</h5>
<div className="typography-box">
<div className="typo-book">
<div className="dnb-typo-book">
<p>
Here is a paragraph with some nonsense lipsum text. Contrary to
popular belief, Lorem Ipsum passage, and going through the cites
Expand All @@ -19,10 +19,10 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
Expand All @@ -31,7 +31,7 @@ const Syntax = () => (

<h5>Fedra Sans Book Italic</h5>
<div className="typography-box">
<div className="typo-book-italic">
<div className="dnb-typo-book-italic">
<p>
Here is a paragraph with some nonsense lipsum text. Contrary to
popular belief, Lorem Ipsum passage, and going through the cites
Expand All @@ -42,20 +42,20 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
</div>
</div>

<h5 className="typo-medium">Fedra Sans Medium</h5>
<h5 className="dnb-typo-medium">Fedra Sans Medium</h5>
<div className="typography-box">
<div className="typo-medium">
<p className="typo-medium">
<div className="dnb-typo-medium">
<p className="dnb-typo-medium">
Here is a paragraph with some nonsense lipsum text. Contrary to
popular belief, Lorem Ipsum passage, and going through the cites
of the word in classical literature, discovered the undoubtable
Expand All @@ -65,10 +65,10 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
Expand All @@ -77,7 +77,7 @@ const Syntax = () => (

<h5>Fedra Sans Medium Italic</h5>
<div className="typography-box">
<div className="typo-medium-italic">
<div className="dnb-typo-medium-italic">
<p>
Here is a paragraph with some nonsense lipsum text. Contrary to
popular belief, Lorem Ipsum passage, and going through the cites
Expand All @@ -88,10 +88,10 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
Expand All @@ -111,10 +111,10 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
Expand All @@ -134,10 +134,10 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
Expand All @@ -157,10 +157,10 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
Expand All @@ -179,10 +179,10 @@ const Syntax = () => (
</p>
<h5>Here are some numbers:</h5>
<div className="dnb-font-family-demo__numbers">
<p className="typo-number--lining">
<p className="dnb-typo-number--lining">
<b>Lining:</b> 123456789
</p>
<p className="typo-number--old-style">
<p className="dnb-typo-number--old-style">
<b>Old style:</b> 123456789
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class SausageItem extends PureComponent {
className="dnb-loan-sausage__sausage__bar"
aria-describedby={title.toLowerCase()}
/>
<div className="dnb-loan-sausage__sausage__item__description typo-demi">
<div className="dnb-loan-sausage__sausage__item__description dnb-typo-demi">
<span
className="dnb-loan-sausage__sausage__description-line"
aria-hidden="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
header: 'UI Library'
title: 'Helper Classes'
status: 'dep'
status: 'wip'
draft: false
order: 5
---
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
header: 'UI Library'
title: 'Anker'
draft: false
order: 1
---

import { IconPrimary as Icon } from 'dnb-ui-lib/src'

# Anker

Beside that the Anker Tag gets assigned by default - or let's say, by only importing the core styles, there are also some classes to handle the visual states manually.

## Default Styles

- `a` <a href="/" >Anker with default style</a>
- `.dnb-hover-style` <a href="/" class="dnb-hover-style">Hover Style</a>
- `.dnb-active-style` <a href="/" class="dnb-active-style">Active Style</a>
- `.dnb-focus-style` <a href="/" class="dnb-focus-style">Focus Style</a>
- `.dnb-with-animation` <a href="/" class="dnb-with-animation">With a special animation Style</a>
- <a>No href</a> results in `user-select: none;`

## With Icon

- <a href="/">Anker with Icon <Icon icon="chevron_right" /></a>
- <p>
Eros semper blandit tellus mollis primis quisque platea sollicitudin
ipsum <a href="/">Inside a Paragraph <Icon icon="bell" /></a> auctor cursus mauris porta consectetur natoque vehicula vestibulum feugiat ultrices vitae fermentum eros euismod imperdiet eleifend justo vivamus posuere
</p>
- <h2>
<a href="/">Inside Headings <Icon icon="bell" /></a> H2
</h2>

## Manipulation

- `.dnb-no-anker-animation` <a href="/" class="dnb-no-anker-animation">No Animation</a>
- `.dnb-no-anker-style` <a href="/" class="dnb-no-anker-style">No Style</a>
- `.dnb-no-anker-hover` <a href="/" class="dnb-no-anker-hover">No Hover</a>
- `.dnb-no-anker-underline` <a href="/" class="dnb-no-anker-underline">No Underline</a>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Read more about the term Page Focus in the [Body Component](/uilib/components/bo
```html
<body>
<aside><!-- focusable navigation --></aside>
<main class="no-focus" tabindex="-1">
<main class="dnb-no-focus" tabindex="-1">
<!-- more markup with focusable HTMLElements -->
</main>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
header: 'UI Library'
title: 'Demos'
status: 'wip'
draft: false
draft: true
---

# Demo Apps
Expand Down
2 changes: 1 addition & 1 deletion packages/dnb-design-system-portal/src/shared/menu/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default class Card extends PureComponent {
>
<Link
css={[linkStyle, customStyle]}
className="no-style"
className="dnb-no-anker-style"
to={url}
onClick={onClick}
>
Expand Down
64 changes: 15 additions & 49 deletions packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,15 @@ const StyledListItem = styled.li`
a {
position: relative;
padding: 0.45em 0 0.45em;
color: var(--color-sea-green);
&:hover {
color: var(--color-ocean-green);
}
&:active {
color: var(--color-white);
}
padding: 0.5125em 0 0.45em; /* 0,0625 */
display: flex;
flex-direction: column;
justify-content: center;
flex-direction: row;
justify-content: space-between;
align-items: center;
line-height: 1.5rem;
/* external link icon */
svg {
float: right;
margin-right: 1em;
span {
line-height: 1rem;
}
}
Expand Down Expand Up @@ -126,30 +114,6 @@ const StyledListItem = styled.li`
font-size: 0.875em;
}
&.active a {
color: var(--color-ocean-green);
&::after {
content: '';
position: absolute;
display: flex;
height: 60%;
width: 4px;
max-height: auto;
/* border-radius: 50%; */
background: var(--color-ocean-green);
transform: translate(-0.6em, -2px);
/* Reset Anker Style */
left: auto;
right: auto;
bottom: auto;
}
}
@keyframes show-mobile-menu {
0% {
opacity: 0;
Expand Down Expand Up @@ -191,15 +155,13 @@ const StyledListItem = styled.li`
}
.status-badge {
position: absolute;
z-index: 2;
right: 1.5rem;
margin-right: 1rem;
display: flex;
justify-content: center;
align-items: baseline; /* then we can set line-height */
font-size: 0.4375rem;
font-size: 7px; /* safari handles rem value incorrectly */
line-height: 1.3125rem; /* same as height + 1px */
font-weight: 100;
text-align: center;
Expand Down Expand Up @@ -403,7 +365,7 @@ class ListItem extends PureComponent {
<StyledListItem
className={classnames(
`l-${level}`,
active && 'active',
active && 'dnb-hover-style', // use anker hover style
status ? `status-${status}` : null,
className
)}
Expand All @@ -412,12 +374,16 @@ class ListItem extends PureComponent {
'--delay': `${nr !== null ? nr * 12 : random(1, 160)}ms`
}}
>
<Link to={to} className="no-underline no-hover">
{children}
<Link
to={to}
className="dnb-no-anker-underline dnb-no-anker-hover"
>
<span>{children}</span>
{status && (
<span
className="status-badge"
title={
' ' +
{
wip: 'Working in Progress',
dep: 'Deprecated',
Expand Down
4 changes: 2 additions & 2 deletions packages/dnb-design-system-portal/src/shared/parts/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Content = ({ className, children }) => (
className={classnames(
'dnb-style',
'dnb-page-content',
'no-focus',
'dnb-no-focus',
className
)}
css={markdownStyle}
Expand Down Expand Up @@ -176,7 +176,7 @@ const Footer = () => (
<FooterWrapper>
<small>
Last Portal update: {buildVersion}
<Link to="/license" className="no-underline">
<Link to="/license" className="dnb-no-anker-underline">
Copyright (c) 2018-present DNB.no
</Link>
</small>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
autocomplete="on"
placeholder="Placeholder text"
description="Kr"
extra_information="Info: numbers are ligned by using typo-number--lining"
extra_information="Info: numbers are ligned by using dnb-typo-number--lining"
ref={this._ref}
on_change={this.handleInputChange}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
typo_class="typo-light-italic"
/>
{/* Standard Medium */}
<Demo font_family="Fedra Sans Medium" typo_class="typo-medium" />
<Demo font_family="Fedra Sans Medium" typo_class="dnb-typo-medium" />
<Demo
font_family="Fedra Sans Medium Italic"
typo_class="typo-medium-italic"
typo_class="dnb-typo-medium-italic"
/>
{/* Standard Bold */}
<Demo font_family="Fedra Sans Bold" typo_class="typo-bold" />
Expand All @@ -18,15 +18,15 @@
typo_class="typo-bold-italic"
/>
{/* Book */}
<Demo font_family="Fedra Sans Book" typo_class="typo-book" />
<Demo font_family="Fedra Sans Book" typo_class="dnb-typo-book" />
<Demo
font_family="Fedra Sans Book Italic"
typo_class="typo-book-italic"
typo_class="dnb-typo-book-italic"
/>
{/* Demi */}
<Demo font_family="Fedra Sans Demi" typo_class="typo-demi" />
<Demo font_family="Fedra Sans Demi" typo_class="dnb-typo-demi" />
<Demo
font_family="Fedra Sans Demi Italic"
typo_class="typo-demi-italic"
typo_class="dnb-typo-demi-italic"
/>
</div>
Loading

0 comments on commit 4a6f3f3

Please sign in to comment.