-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/DES-488-hero-image
# Conflicts: # packages/css/src/components/index.scss # packages/react/src/index.ts
- Loading branch information
Showing
11 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Mark | ||
|
||
Markeert een fragment tekst met een gele achtergrond. | ||
Het zorgt voor sterke nadruk op de tekst en leidt de aandacht ernaartoe. | ||
|
||
## Richtlijnen | ||
|
||
### Zo gebruiken | ||
|
||
- Maximaal 1 markering per pagina. | ||
De voorkeur is geen markering. | ||
- Maximaal 1 zin. | ||
|
||
### Dit vermijden | ||
|
||
- Niet in de titel en subtitels gebruiken. | ||
Zorg voor een belangrijke, pakkende titel als de hele paragraaf belangrijk is. | ||
- Mag niet voor een hele paragraaf gebruikt worden. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @license EUPL-1.2+ | ||
* Copyright (c) 2023 Gemeente Amsterdam | ||
*/ | ||
|
||
.amsterdam-mark { | ||
background-color: var(--amsterdam-mark-background-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { render } from '@testing-library/react' | ||
import { createRef } from 'react' | ||
import { Mark } from './Mark' | ||
import '@testing-library/jest-dom' | ||
|
||
describe('Mark', () => { | ||
it('renders', () => { | ||
const { container } = render(<Mark />) | ||
const component = container.querySelector(':only-child') | ||
expect(component).toBeInTheDocument() | ||
expect(component).toBeVisible() | ||
}) | ||
|
||
it('renders a design system BEM class name', () => { | ||
const { container } = render(<Mark />) | ||
const component = container.querySelector(':only-child') | ||
expect(component).toHaveClass('amsterdam-mark') | ||
}) | ||
|
||
it('renders an additional class name', () => { | ||
const { container } = render(<Mark className="extra" />) | ||
const component = container.querySelector(':only-child') | ||
expect(component).toHaveClass('amsterdam-mark extra') | ||
}) | ||
|
||
it('supports ForwardRef in React', () => { | ||
const ref = createRef<HTMLElement>() | ||
const { container } = render(<Mark ref={ref} />) | ||
const component = container.querySelector(':only-child') | ||
expect(ref.current).toBe(component) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @license EUPL-1.2+ | ||
* Copyright (c) 2023 Gemeente Amsterdam | ||
*/ | ||
|
||
import clsx from 'clsx' | ||
import { ForwardedRef, forwardRef, HTMLAttributes, PropsWithChildren } from 'react' | ||
|
||
export interface MarkProps extends PropsWithChildren<HTMLAttributes<HTMLElement>> {} | ||
|
||
export const Mark = forwardRef(({ children, className, ...restProps }: MarkProps, ref: ForwardedRef<HTMLElement>) => ( | ||
<mark {...restProps} ref={ref} className={clsx('amsterdam-mark', className)}> | ||
{children} | ||
</mark> | ||
)) | ||
|
||
Mark.displayName = 'Mark' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# React Mark component | ||
|
||
[Mark documentation](../../../css/src/mark/README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { Mark } from './Mark' | ||
export type { MarkProps } from './Mark' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"amsterdam": { | ||
"mark": { | ||
"background-color": { "value": "var(--amsterdam-color-yellow)" } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Markdown, Meta, Primary } from "@storybook/blocks"; | ||
import * as MarkStories from "./Mark.stories.tsx"; | ||
import README from "../../../../packages/css/src/components/mark/README.md?raw"; | ||
|
||
<Meta of={MarkStories} /> | ||
|
||
<Markdown>{README}</Markdown> | ||
|
||
## Voorbeeld | ||
|
||
<Primary /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @license EUPL-1.2+ | ||
* Copyright (c) 2023 Gemeente Amsterdam | ||
*/ | ||
|
||
import { Mark, Paragraph } from '@amsterdam/design-system-react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
|
||
const meta = { | ||
title: 'Text/Mark', | ||
component: Mark, | ||
args: { | ||
children: 'Nieuw component', | ||
}, | ||
} satisfies Meta<typeof Mark> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { | ||
children: 'Wat vinden Amsterdammers belangrijk?', | ||
}, | ||
render: ({ children }) => ( | ||
<Paragraph> | ||
Daarom organiseren we in 2024 het burgerberaad schone stad, waarin 150 Amsterdammers in gesprek gaan over hoe we | ||
de stad beter schoonhouden. <Mark>{children}</Mark> Welke oplossingen zien zij? Hier zijn we benieuwd naar. Want | ||
elke Amsterdammer heeft afval en moet het kwijt. Wij kunnen als gemeente veel van deze afvalexperts leren. | ||
</Paragraph> | ||
), | ||
} |