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

Feature/#79 cards case #134

Merged
merged 104 commits into from
Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
c1fe19b
Merge pull request #1 from Gemeente-DenHaag/development
mjcarsjens Jan 7, 2021
c113a56
Merge pull request #18 from Gemeente-DenHaag/development
GewoonMaarten Feb 8, 2021
5cf2a80
Merge pull request #47 from Gemeente-DenHaag/development
bddjong Feb 27, 2021
48056ab
Merge pull request #97 from Gemeente-DenHaag/development
mjcarsjens Mar 19, 2021
61b3fc9
Only allow lerna publish from master
MCarsjensGX Mar 19, 2021
04df562
Publish
MCarsjensGX Mar 19, 2021
b1ca3b8
Merge pull request #108 from Gemeente-DenHaag/development
bddjong Mar 27, 2021
cd38ac7
Added initial version of card and cardheader styling
joostvanviegen Apr 10, 2021
4a72bf8
Merge remote-tracking branch 'origin/feature/#123-core-styles-package…
joostvanviegen Apr 14, 2021
9787444
Applied styling to Card and changed card's hex values to hsl
joostvanviegen Apr 14, 2021
9c45273
switching cardstyle based on the variant.
joostvanviegen Apr 14, 2021
59bbd76
Added color to card case and padding to the top of card
joostvanviegen Apr 14, 2021
d6a2985
WIP:Including multiple components in Card
joostvanviegen Apr 14, 2021
c2a4a56
Merge branch 'feature/#123-core-styles-package' into feature/#79-Card…
joostvanviegen Apr 21, 2021
fe5ff49
Removed padding from cardcontent
joostvanviegen Apr 21, 2021
0d2a48e
Moved cards story to reflect the way cards are represented in the des…
joostvanviegen Apr 21, 2021
bea1cab
Fixed arrow position and text color
joostvanviegen Apr 24, 2021
a90be13
Fixed border of Case / card
joostvanviegen Apr 24, 2021
424e52d
Added paper svg file to case / card
joostvanviegen Apr 24, 2021
348666e
Added title, subtitle and date properties to card
joostvanviegen Apr 28, 2021
c8d296a
Correctly padded date on left side
joostvanviegen Apr 28, 2021
a15a8f3
Correctly positioned the date and arrow on cards
joostvanviegen Apr 28, 2021
42361e4
Suggested changes to Card to show properly as folder and changed arou…
MCarsjensGX Apr 30, 2021
3c0dc32
Added correct borders to card/case
joostvanviegen May 1, 2021
1b95f7e
Added on-hover perspective change to card/case
joostvanviegen May 1, 2021
deb2236
Remove merge conflicts and reduce amount of design tokens for Button
Apr 28, 2021
54bcd83
Made text darker on hover
joostvanviegen May 5, 2021
0316f3f
WIP: focus border color title and subtitle
joostvanviegen May 5, 2021
d33c833
Add base styles package
Apr 7, 2021
05ef0ef
Add css as default export
Apr 7, 2021
2d8c84d
Change tsx in basestyles/package.json to ts
Apr 7, 2021
d66ed74
Changed colour hex values to hsl
joostvanviegen Apr 10, 2021
7fcde40
Fix incorrect HSL value for --denhaag-green-1
bddjong Apr 14, 2021
437bffd
Changed hsl values to modern notation
joostvanviegen Apr 21, 2021
1c607de
Update README.md
GewoonMaarten Apr 24, 2021
8b5a96c
Storybook show code fix (#117)
ogjtech Apr 24, 2021
cb85146
Fix/#42 fix installation files (#137)
GewoonMaarten Apr 28, 2021
dadf73b
Hot fix (#149)
GewoonMaarten May 1, 2021
3137cb5
Feature/#46 icons (#158)
GewoonMaarten May 5, 2021
55c3d36
Move basestyles to styles subfolder
bddjong May 1, 2021
61dc344
Split design tokens and brand tokens
bddjong May 1, 2021
24e147b
Add styles folder to workspaces
bddjong May 1, 2021
c4f6fcc
Use den haag brand tokens in storybook
bddjong May 1, 2021
4698f89
Fixed visibility of focus border
joostvanviegen May 8, 2021
6062984
Made card focussable
joostvanviegen May 8, 2021
c27bdd9
Merge branch 'development' into feature/#79-Cards-Case
joostvanviegen May 8, 2021
b5e7b61
merge changes
joostvanviegen May 12, 2021
b7e9904
Removed include of card story in tsconfig cardactions
joostvanviegen May 12, 2021
c621b6f
Add css files to dist directories of Card, CardHeader, CardContent
joostvanviegen May 12, 2021
bb4c379
Fixed style of card/case on focus
joostvanviegen May 12, 2021
51447f0
Fixed story book args to map to interface
joostvanviegen May 12, 2021
891519a
Removed unused raised property from card
joostvanviegen May 12, 2021
2bf83ce
Merge branch 'development' into feature/#79-Cards-Case
joostvanviegen May 12, 2021
2af799f
Moved card /case design tokens into Basestyles Package
joostvanviegen May 15, 2021
00b4a2b
Use builtin fontsizes
joostvanviegen May 18, 2021
c0b9556
Fixed some design token references in Card/Case
joostvanviegen May 19, 2021
91cb20e
Increased height on background::before to remove gap
joostvanviegen May 19, 2021
7e059af
Compensate padding of border text with focus
joostvanviegen May 19, 2021
f8da9f0
Added workaround because of chrome focus state
joostvanviegen May 19, 2021
f2c6c20
Merge branch 'development' of github.com:Gemeente-DenHaag/denhaag-com…
joostvanviegen May 19, 2021
ecbb2dc
Changed font size token to point to correct css variable
joostvanviegen May 19, 2021
6f4539f
Merge branch 'development' of github.com:Gemeente-DenHaag/denhaag-com…
joostvanviegen May 22, 2021
3c8432e
Updated the Card because of new styling packages
joostvanviegen May 22, 2021
2338dfc
Merge branch 'development' of github.com:Gemeente-DenHaag/denhaag-com…
joostvanviegen May 26, 2021
7ac0226
Move css to .css files instead of .module.css to fix clean react pro…
joostvanviegen May 26, 2021
150458f
change css variable names to adhere correct naming scheme
joostvanviegen May 26, 2021
58930f6
Changed naming of some css variables
joostvanviegen May 26, 2021
dd6089a
Changed focusborder of text to outline and added outline to arrow of
joostvanviegen May 26, 2021
02217ff
Merge branch 'master' of github.com:Gemeente-DenHaag/denhaag-componen…
joostvanviegen May 26, 2021
87f24fb
Added onclick and tabindex as properties
joostvanviegen May 26, 2021
f814323
NewLines
joostvanviegen Jun 2, 2021
ab86293
Fix spelling errors secundary -> secondary
joostvanviegen Jun 2, 2021
ea6c970
Remove commented code
joostvanviegen Jun 2, 2021
6497a11
Simplified border radiu of card--case
joostvanviegen Jun 2, 2021
7a8d0cd
Remove obsolete tokens files
joostvanviegen Jun 2, 2021
967db9a
Use React event for onclick
joostvanviegen Jun 2, 2021
fa9180e
Fixed bem classnames
joostvanviegen Jun 2, 2021
a06f6ae
Added time html5 tag around the date in card
joostvanviegen Jun 2, 2021
3976d34
Fixed the input of time html5 tag
joostvanviegen Jun 2, 2021
accaf1d
Renamed CardActions file and reduced exports of Card
joostvanviegen Jun 2, 2021
21d5418
Fix MouseEvent type
joostvanviegen Jun 9, 2021
26e0691
Move some remaiing tokens to tokens-card
joostvanviegen Jun 9, 2021
7860d3d
Sorted all properties alphabetically
joostvanviegen Jun 9, 2021
3dfb48c
card-header bem naming
joostvanviegen Jun 9, 2021
af4fa0d
Remove cardcasefocusclasses from bem mapping
joostvanviegen Jun 9, 2021
a1434ba
Rename card__text wrapper to card-text-wrapper
joostvanviegen Jun 9, 2021
509512d
Move cardactions styling token to tokens-card
joostvanviegen Jun 9, 2021
f3fcda7
Cleanup properties of actions and content
joostvanviegen Jun 9, 2021
3ca53c5
Removed obsolete cardheader component
joostvanviegen Jun 9, 2021
a4d87a8
added --hover and --focus to selectors and formatted the selectors be…
joostvanviegen Jun 9, 2021
6f9081b
Correctly fix bem naming of the text wrapper
joostvanviegen Jun 9, 2021
091f39d
Fixed some inconsistencies in card.css
joostvanviegen Jun 9, 2021
96a67b3
Added stylelint ignore line descending specifity
joostvanviegen Jun 9, 2021
dc6093e
Clearer naming of wrapper padding
joostvanviegen Jun 9, 2021
814a94b
Change override of cardcontent: use start and end
joostvanviegen Jun 9, 2021
bedfd24
Added focus border around all arrow card variants
joostvanviegen Jun 9, 2021
0f0110a
split title padding tokens
joostvanviegen Jun 16, 2021
b59142e
removed tabindex from card/case and changed the title to an anchor ta…
joostvanviegen Jun 16, 2021
3915cf5
replaced padding inline and block properties by their start and end c…
joostvanviegen Jun 16, 2021
f192dee
Merge branch 'master' of github.com:Gemeente-DenHaag/denhaag-componen…
joostvanviegen Jun 16, 2021
fd89892
Ran prettier to fix some minor issues
joostvanviegen Jun 16, 2021
9b6c93f
Fixed CSS token naming
DanielvanVliet Jun 19, 2021
12e92eb
removed typography component
DanielvanVliet Jun 19, 2021
23969b7
Merge remote-tracking branch 'origin/master' into feature/#79-Cards-Case
DanielvanVliet Jun 19, 2021
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 .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: build storybook
run: yarn build-storybook

- name: Run Cypress component tests
uses: cypress-io/github-action@v2
with:
Expand Down
7 changes: 2 additions & 5 deletions src/components/Card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dist"
],
"scripts": {
"build": "tsc -b",
"build": "tsc -b && copyfiles -u 1 \"src/**/*.css\" dist",
"clean": "yarn rimraf dist tsconfig.tsbuildinfo"
},
"dependencies": {
Expand All @@ -29,10 +29,7 @@
"react": "^17.0.1"
},
"devDependencies": {
"@gemeente-denhaag/avatar": "*",
"@gemeente-denhaag/iconbutton": "*",
"@gemeente-denhaag/icons": "*",
"@gemeente-denhaag/typography": "*"
"@gemeente-denhaag/icons": "*"
},
"gitHead": "dcf72a9b79266c1ebede35aff4a02dd9121a980f"
}
22 changes: 0 additions & 22 deletions src/components/Card/src/Card.tsx

This file was deleted.

110 changes: 110 additions & 0 deletions src/components/Card/src/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import React, { createRef } from 'react';
import MaterialCard from '@material-ui/core/Card';
import { StylesProvider } from '@material-ui/core/styles';
import { ArrowRightIcon } from '@gemeente-denhaag/icons';
import BaseProps from '@gemeente-denhaag/baseprops';
import './mui-override.css';
import './card.css';
import { Typography } from '@material-ui/core';
import { cardClasses, cardArrowClasses, cardTitleClasses, cardSubtitleClasses, cardCaseClasses } from './bem-mapping';
import { CardContent } from '../CardContent/CardContent';
import { CardActions } from '../CardActions/CardActions';
import { Icon } from '@material-ui/core';

export interface CardProps extends BaseProps {
/**
* Callback fired when the Card is clicked.
*/
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;

/**
* Determines the variant of the card
* Variant can be either `basic` or `case`
*/
variant?: 'basic' | 'case';

/**
* Determines the title of the card
*/
title: string;

/**
* Determines the subtitle of the card
*/
subTitle?: string;

/**
* Determines the date shown on the card
*/
date: Date;

/**
* Determines the url the card points to
*/
href: string;
}

/**
* Primary UI component for user interaction
*/
export const Card: React.FC<CardProps> = (props: CardProps) => {
let classes;
const arrowClasses = cardArrowClasses;
const titleClasses = cardTitleClasses;
const subtitleClasses = cardSubtitleClasses;
const linkRef = createRef<HTMLAnchorElement>();

const title = (
<a href={props.href} ref={linkRef}>
{props.title}
</a>
);

const onClick = () => {
if (linkRef.current !== null) {
linkRef.current.click();
}
};

switch (props.variant) {
case 'case':
classes = cardCaseClasses;
break;
case 'basic':
default:
classes = cardClasses;
}

return (
<StylesProvider injectFirst>
<MaterialCard classes={classes} onClick={onClick}>
<div className="denhaag-card__wrapper">
<div className="denhaag-card__background"></div>
<CardContent>
<div className="denhaag-card__text-wrapper">
<Typography classes={titleClasses} component="p">
{title}
</Typography>
Comment on lines +85 to +87
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice use of the <a> tag, looks like this is a solid setup wrt a11y!
Two questions:

  • What made you decide to place the HTML of the <a>-tag in a variable instead of just right here?
  • Might be a bit of a discussion point whether or not a <p> HTML tag is actually semantically correct here. As the name implies <p> is a paragraph tag, used to semantically markup a piece of text as a paragraph. In my eyes a single line of text for a title or a subtitle does not make a paragraph which makes me think this is not actually semantically correct HTML use. Not sure what the best approach would be in this construction though as the Typography component is necessary for the styling. My first thought is to use a extra <div> for the block, with a Typography component which uses a HTML span.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the first point, I think this helps to make clear where the react Ref is used and we should stick to this.
For the second point, in the future we should refactor CardCase to make use of the updated Typography component from our library. We can move the discussion to that refactoring.
#253

<Typography classes={subtitleClasses} component="p">
{props.subTitle}
</Typography>
</div>
<CardActions disableSpacing={true}>
<Typography component="div" classes={subtitleClasses}>
<time dateTime={props.date.toDateString()}>{props.date.toLocaleDateString()}</time>
</Typography>
<Icon classes={arrowClasses} aria-label="ArrowRightIcon">
<ArrowRightIcon />
</Icon>
</CardActions>
</CardContent>
</div>
</MaterialCard>
</StylesProvider>
);
};

/**
* Default export for Card
*/
export default Card;
23 changes: 23 additions & 0 deletions src/components/Card/src/Card/bem-mapping.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export const cardClasses = {
root: 'denhaag-card',
};

export const cardArrowClasses = {
root: 'denhaag-card__arrow',
};

export const cardTitleClasses = {
root: 'denhaag-card__title',
};

export const cardSubtitleClasses = {
root: 'denhaag-card__subtitle',
};

export const cardPaperClasses = {
root: 'denhaag-card__paper',
};

export const cardCaseClasses = {
root: 'denhaag-card denhaag-card--case',
};
Loading