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

Add Logo Component #755

Merged
merged 37 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
07a1456
Scaffolding of logo, asset loading test
dlnr Nov 10, 2023
1cfa8f1
Logo Variants
dlnr Nov 10, 2023
2cad227
Alt tag
dlnr Nov 10, 2023
e65962d
Merge branch 'main' of https://github.com/Amsterdam/design-system int…
dlnr Nov 14, 2023
30bd95e
One less function
dlnr Nov 14, 2023
59a1e62
One less logo file
dlnr Nov 14, 2023
747f725
Assets in react workspace
dlnr Nov 14, 2023
f13f61b
Copy documentation from current website
VincentSmedinga Nov 14, 2023
4ee6d3a
Typescript import error fix
dlnr Nov 15, 2023
d18a21a
Merge branch 'feature/DES-492-logo-component' of https://github.com/A…
dlnr Nov 15, 2023
374e82b
Refactor SVG as component
dlnr Nov 15, 2023
634e543
Role IMG for svg's
dlnr Nov 15, 2023
97dd99f
Role for component
dlnr Nov 15, 2023
28080b8
Deleted empty tokens
dlnr Nov 15, 2023
7616b25
Remove unwanted whitespace
VincentSmedinga Nov 15, 2023
16eb093
Style a class rather than a child element
VincentSmedinga Nov 15, 2023
910260d
Add whitespace and sort attributes
VincentSmedinga Nov 15, 2023
43aa5f7
Replace hardcoded color codes with design tokens
VincentSmedinga Nov 15, 2023
d271dc5
Use consistent casing for abbreviations
VincentSmedinga Nov 15, 2023
a8e476b
Rename ‘variant’ prop to ‘brand’
VincentSmedinga Nov 15, 2023
86367fd
Apply suggestions from code review
VincentSmedinga Nov 15, 2023
dc9364e
Restore fill colours in SVG as fallback for missing CSS
VincentSmedinga Nov 15, 2023
3e7ea1c
Merge branch 'main' of https://github.com/Amsterdam/design-system int…
dlnr Nov 15, 2023
df0b60c
Logo seperated graphic, text and subtitle
dlnr Nov 15, 2023
6b6473f
Logo tokens and CSS for svg parts
dlnr Nov 16, 2023
badd032
Remove a11y tweaks in svg
dlnr Nov 16, 2023
4baa1f8
Logo with link story
dlnr Nov 16, 2023
fd52705
Remove link test
dlnr Nov 16, 2023
f2e7a56
Some feedback
dlnr Nov 16, 2023
3620528
Update packages/css/src/logo/README.md
dlnr Nov 16, 2023
fb0005d
Readme edits and circular deps lgo brand fix
dlnr Nov 17, 2023
2d17698
Merge branch 'develop' of https://github.com/Amsterdam/design-system …
dlnr Nov 22, 2023
997efe8
Just the svg
dlnr Nov 22, 2023
6b3a4ea
logo height and path css
dlnr Nov 22, 2023
cad8183
Pass ref to LogoComponents
alimpens Nov 22, 2023
e36be0f
Fix lockfile
alimpens Nov 22, 2023
dd81624
Class renames and css cleanup
dlnr Nov 22, 2023
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
1 change: 1 addition & 0 deletions packages/css/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

/* Append here */
@import "./logo/logo";
@import "./image/image";
@import "./pagination/pagination";
@import "./accordion/accordion";
Expand Down
35 changes: 35 additions & 0 deletions packages/css/src/logo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Logo

Het logo van de gemeente bestaat uit een beeldmerk (3 Andreaskruisen) en een woordmerk (Gemeente Amsterdam).
Het logo heeft een vaste kleur, grootte en positie en staat op al onze websites.

## Specificaties

Gebruik altijd het online logo.
dlnr marked this conversation as resolved.
Show resolved Hide resolved
Het Nederlandse logo voor Nederlandstalige websites en anderstalige websites behalve Engels.
Het Engelstalige logo gebruiken we voor Engelstalige websites.
alimpens marked this conversation as resolved.
Show resolved Hide resolved

## Uitzondering

Gebruik het submerklogo als de website eigendom is van 1 van de 4 submerken.
Zij hebben een aparte status omdat er sprake is van een bijzondere vorm van dienstverlening die niet direct met de gemeente in verband wordt gebracht.

De submerken zijn:

- GGD Amsterdam
- Stadsarchief
- Stadsbank van Lening
- VGA Verzekeringen

## Eisen voor alle logo´s

- Het logo wordt altijd getoond.
- Het logo is linksboven uitgelijnd in de header.
- Het logo verwijst naar de homepage.
alimpens marked this conversation as resolved.
Show resolved Hide resolved
- Als de applicatie een formulier, applicatie of tool is zonder homepage, dan linkt het logo naar de pagina op Amsterdam.nl van waar naar het formulier, applicatie of tool wordt verwezen.
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved

De hoogte van het logo is altijd 40 pixels. Dit geldt ook voor de submerklogo´s.

## Download

- [Logoset voor website en apps (ZIP, 10 kB)](https://assets.amsterdam.nl/publish/pages/1007650/logoset_voor_websites_en_apps.zip)
13 changes: 13 additions & 0 deletions packages/css/src/logo/logo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @license EUPL-1.2+
* Copyright (c) 2023 Gemeente Amsterdam
*/

.amsterdam-logo {
display: inline-block;

img {
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
height: 40px;
width: 115px;
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
}
}
2 changes: 2 additions & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"dist/"
],
"dependencies": {
"@amsterdam/design-system-assets": "workspace:*",
"@amsterdam/design-system-react-icons": "workspace:*",
"@utrecht/component-library-react": "1.0.1",
"clsx": "2.0.0",
Expand All @@ -45,6 +46,7 @@
"@babel/runtime": "7.23.2",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-commonjs": "25.0.7",
"@rollup/plugin-image": "3.0.3",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/pluginutils": "5.0.5",
"@testing-library/dom": "9.3.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/react/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import nodeExternal from 'rollup-plugin-node-externals'
import nodePolyfills from 'rollup-plugin-node-polyfills'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import typescript from 'rollup-plugin-typescript2'
import image from '@rollup/plugin-image'

const packageJson = JSON.parse(readFileSync('./package.json', 'utf8'))

Expand Down Expand Up @@ -56,6 +57,7 @@ export default [
plugins: ['@babel/plugin-transform-runtime'],
}),
filesize(),
image(),
],
},
]
43 changes: 43 additions & 0 deletions packages/react/src/Logo/Logo.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { render } from '@testing-library/react'
import { createRef } from 'react'
import { Logo } from './Logo'
import '@testing-library/jest-dom'

describe('Logo', () => {
it('renders', () => {
const { container } = render(<Logo />)

const component = container.querySelector(':only-child')

expect(component).toBeInTheDocument()
expect(component).toBeVisible()
})

it('renders a design system BEM class name', () => {
const { container } = render(<Logo />)

const component = container.querySelector(':only-child')

expect(component).toHaveClass('amsterdam-logo')
})

it('renders an additional class name', () => {
const { container } = render(<Logo className="extra" />)

const component = container.querySelector(':only-child')

expect(component).toHaveClass('extra')

expect(component).toHaveClass('amsterdam-logo')
})

it('supports ForwardRef in React', () => {
const ref = createRef<HTMLElement>()

const { container } = render(<Logo ref={ref} />)

const component = container.querySelector(':only-child')

expect(ref.current).toBe(component)
})
})
41 changes: 41 additions & 0 deletions packages/react/src/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @license EUPL-1.2+
* Copyright (c) 2023 Gemeente Amsterdam
*/

import LogoAmsterdam from '@amsterdam/design-system-assets/logo/amsterdam.svg'
import LogoGGD from '@amsterdam/design-system-assets/logo/ggd-amsterdam.svg'
import LogoStadsarchief from '@amsterdam/design-system-assets/logo/stadsarchief.svg'
import LogoStadsbankLening from '@amsterdam/design-system-assets/logo/stadsbank-lening.svg'
import LogoVGA from '@amsterdam/design-system-assets/logo/vga-verzekeringen.svg'
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
import clsx from 'clsx'
import { ForwardedRef, forwardRef, HTMLAttributes } from 'react'

export interface LogoProps extends HTMLAttributes<HTMLElement> {
variant?: 'amsterdam' | 'ggd-amsterdam' | 'stadsarchief' | 'stadsbank-lening' | 'vga-verzekeringen'
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
}

function getLogoVariant(variant: LogoProps['variant']) {
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
switch (variant) {
case 'amsterdam':
return { logo: LogoAmsterdam, alt: 'Gemeente Amsterdam' }
case 'ggd-amsterdam':
return { logo: LogoGGD, alt: 'GGD Amsterdam' }
case 'stadsarchief':
return { logo: LogoStadsarchief, alt: 'Stadsarchief Amsterdam' }
case 'stadsbank-lening':
return { logo: LogoStadsbankLening, alt: 'Stadsbank van Lening' }
case 'vga-verzekeringen':
return { logo: LogoVGA, alt: 'VGA Verzekeringen' }
default:
return { logo: LogoAmsterdam, alt: 'Gemeente Amsterdam' }
}
}

export const Logo = forwardRef(({ variant, className, ...restProps }: LogoProps, ref: ForwardedRef<HTMLElement>) => (
<span {...restProps} ref={ref} className={clsx('amsterdam-logo', className)}>
<img src={getLogoVariant(variant).logo} alt={`Logo ${getLogoVariant(variant).alt}`} />
</span>
))

Logo.displayName = 'Logo'
3 changes: 3 additions & 0 deletions packages/react/src/Logo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# React Logo component

[Logo documentation](../../../css/src/logo/README.md)
2 changes: 2 additions & 0 deletions packages/react/src/Logo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Logo } from './Logo'
export type { LogoProps } from './Logo'
4 changes: 4 additions & 0 deletions packages/react/src/Logo/types/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: any
export default content
}
1 change: 1 addition & 0 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

/* Append here */
export * from './Logo'
export * from './Image'
export * from './Pagination'
export * from './Screen'
Expand Down
3 changes: 2 additions & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es2020"
"target": "es2020",
"typeRoots": ["node_modules/@types", "src/**/*.d.ts"]
alimpens marked this conversation as resolved.
Show resolved Hide resolved
},
"include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
Expand Down
26 changes: 26 additions & 0 deletions pnpm-lock.yaml

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

File renamed without changes
17 changes: 17 additions & 0 deletions proprietary/assets/logo/ggd-amsterdam.svg
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading