-
Notifications
You must be signed in to change notification settings - Fork 7
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
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 c113a56
Merge pull request #18 from Gemeente-DenHaag/development
GewoonMaarten 5cf2a80
Merge pull request #47 from Gemeente-DenHaag/development
bddjong 48056ab
Merge pull request #97 from Gemeente-DenHaag/development
mjcarsjens 61b3fc9
Only allow lerna publish from master
MCarsjensGX 04df562
Publish
MCarsjensGX b1ca3b8
Merge pull request #108 from Gemeente-DenHaag/development
bddjong cd38ac7
Added initial version of card and cardheader styling
joostvanviegen 4a72bf8
Merge remote-tracking branch 'origin/feature/#123-core-styles-package…
joostvanviegen 9787444
Applied styling to Card and changed card's hex values to hsl
joostvanviegen 9c45273
switching cardstyle based on the variant.
joostvanviegen 59bbd76
Added color to card case and padding to the top of card
joostvanviegen d6a2985
WIP:Including multiple components in Card
joostvanviegen c2a4a56
Merge branch 'feature/#123-core-styles-package' into feature/#79-Card…
joostvanviegen fe5ff49
Removed padding from cardcontent
joostvanviegen 0d2a48e
Moved cards story to reflect the way cards are represented in the des…
joostvanviegen bea1cab
Fixed arrow position and text color
joostvanviegen a90be13
Fixed border of Case / card
joostvanviegen 424e52d
Added paper svg file to case / card
joostvanviegen 348666e
Added title, subtitle and date properties to card
joostvanviegen c8d296a
Correctly padded date on left side
joostvanviegen a15a8f3
Correctly positioned the date and arrow on cards
joostvanviegen 42361e4
Suggested changes to Card to show properly as folder and changed arou…
MCarsjensGX 3c0dc32
Added correct borders to card/case
joostvanviegen 1b95f7e
Added on-hover perspective change to card/case
joostvanviegen deb2236
Remove merge conflicts and reduce amount of design tokens for Button
54bcd83
Made text darker on hover
joostvanviegen 0316f3f
WIP: focus border color title and subtitle
joostvanviegen d33c833
Add base styles package
05ef0ef
Add css as default export
2d8c84d
Change tsx in basestyles/package.json to ts
d66ed74
Changed colour hex values to hsl
joostvanviegen 7fcde40
Fix incorrect HSL value for --denhaag-green-1
bddjong 437bffd
Changed hsl values to modern notation
joostvanviegen 1c607de
Update README.md
GewoonMaarten 8b5a96c
Storybook show code fix (#117)
ogjtech cb85146
Fix/#42 fix installation files (#137)
GewoonMaarten dadf73b
Hot fix (#149)
GewoonMaarten 3137cb5
Feature/#46 icons (#158)
GewoonMaarten 55c3d36
Move basestyles to styles subfolder
bddjong 61dc344
Split design tokens and brand tokens
bddjong 24e147b
Add styles folder to workspaces
bddjong c4f6fcc
Use den haag brand tokens in storybook
bddjong 4698f89
Fixed visibility of focus border
joostvanviegen 6062984
Made card focussable
joostvanviegen c27bdd9
Merge branch 'development' into feature/#79-Cards-Case
joostvanviegen b5e7b61
merge changes
joostvanviegen b7e9904
Removed include of card story in tsconfig cardactions
joostvanviegen c621b6f
Add css files to dist directories of Card, CardHeader, CardContent
joostvanviegen bb4c379
Fixed style of card/case on focus
joostvanviegen 51447f0
Fixed story book args to map to interface
joostvanviegen 891519a
Removed unused raised property from card
joostvanviegen 2bf83ce
Merge branch 'development' into feature/#79-Cards-Case
joostvanviegen 2af799f
Moved card /case design tokens into Basestyles Package
joostvanviegen 00b4a2b
Use builtin fontsizes
joostvanviegen c0b9556
Fixed some design token references in Card/Case
joostvanviegen 91cb20e
Increased height on background::before to remove gap
joostvanviegen 7e059af
Compensate padding of border text with focus
joostvanviegen f8da9f0
Added workaround because of chrome focus state
joostvanviegen f2c6c20
Merge branch 'development' of github.com:Gemeente-DenHaag/denhaag-com…
joostvanviegen ecbb2dc
Changed font size token to point to correct css variable
joostvanviegen 6f4539f
Merge branch 'development' of github.com:Gemeente-DenHaag/denhaag-com…
joostvanviegen 3c8432e
Updated the Card because of new styling packages
joostvanviegen 2338dfc
Merge branch 'development' of github.com:Gemeente-DenHaag/denhaag-com…
joostvanviegen 7ac0226
Move css to .css files instead of .module.css to fix clean react pro…
joostvanviegen 150458f
change css variable names to adhere correct naming scheme
joostvanviegen 58930f6
Changed naming of some css variables
joostvanviegen dd6089a
Changed focusborder of text to outline and added outline to arrow of
joostvanviegen 02217ff
Merge branch 'master' of github.com:Gemeente-DenHaag/denhaag-componen…
joostvanviegen 87f24fb
Added onclick and tabindex as properties
joostvanviegen f814323
NewLines
joostvanviegen ab86293
Fix spelling errors secundary -> secondary
joostvanviegen ea6c970
Remove commented code
joostvanviegen 6497a11
Simplified border radiu of card--case
joostvanviegen 7a8d0cd
Remove obsolete tokens files
joostvanviegen 967db9a
Use React event for onclick
joostvanviegen fa9180e
Fixed bem classnames
joostvanviegen a06f6ae
Added time html5 tag around the date in card
joostvanviegen 3976d34
Fixed the input of time html5 tag
joostvanviegen accaf1d
Renamed CardActions file and reduced exports of Card
joostvanviegen 21d5418
Fix MouseEvent type
joostvanviegen 26e0691
Move some remaiing tokens to tokens-card
joostvanviegen 7860d3d
Sorted all properties alphabetically
joostvanviegen 3dfb48c
card-header bem naming
joostvanviegen af4fa0d
Remove cardcasefocusclasses from bem mapping
joostvanviegen a1434ba
Rename card__text wrapper to card-text-wrapper
joostvanviegen 509512d
Move cardactions styling token to tokens-card
joostvanviegen f3fcda7
Cleanup properties of actions and content
joostvanviegen 3ca53c5
Removed obsolete cardheader component
joostvanviegen a4d87a8
added --hover and --focus to selectors and formatted the selectors be…
joostvanviegen 6f9081b
Correctly fix bem naming of the text wrapper
joostvanviegen 091f39d
Fixed some inconsistencies in card.css
joostvanviegen 96a67b3
Added stylelint ignore line descending specifity
joostvanviegen dc6093e
Clearer naming of wrapper padding
joostvanviegen 814a94b
Change override of cardcontent: use start and end
joostvanviegen bedfd24
Added focus border around all arrow card variants
joostvanviegen 0f0110a
split title padding tokens
joostvanviegen b59142e
removed tabindex from card/case and changed the title to an anchor ta…
joostvanviegen 3915cf5
replaced padding inline and block properties by their start and end c…
joostvanviegen f192dee
Merge branch 'master' of github.com:Gemeente-DenHaag/denhaag-componen…
joostvanviegen fd89892
Ran prettier to fix some minor issues
joostvanviegen 9b6c93f
Fixed CSS token naming
DanielvanVliet 12e92eb
removed typography component
DanielvanVliet 23969b7
Merge remote-tracking branch 'origin/master' into feature/#79-Cards-Case
DanielvanVliet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
This file was deleted.
Oops, something went wrong.
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,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> | ||
<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; |
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,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', | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
<a>
-tag in a variable instead of just right here?<p>
HTML tag is actually semantically correct here. As the name implies<p>
is aparagraph
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 theTypography
component is necessary for the styling. My first thought is to use a extra<div>
for the block, with aTypography
component which uses a HTMLspan
.There was a problem hiding this comment.
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