-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Card: add component #387
Card: add component #387
Conversation
function Card(props) { | ||
const { children, className, ...rest } = props | ||
const classes = cx( | ||
className, |
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.
Add ui
class as the first class. Then, put the user's className as the last class.
Great, glad to have this started again. Let's get the subcomponents in and a doc example going. Reference the Rating docs for the most recent doc site pattern. |
API looks like a good start. Linking to the docs is helpful but you don't have to go through that if you don't want! Still thinking about the absence of the We just need to add the subcomponents now: Content<div class="content"></div> <Card.Content /> extra<div class="extra content"></div> <Card.Content extra /> Header<div class="header"></div> <Card.Header /> Description<div class="description"></div> <Card.Description /> Meta<div class="meta"></div> <Card.Meta /> |
Current coverage is 95.10% (diff: 100%)@@ master #387 diff @@
==========================================
Files 85 91 +6
Lines 1119 1165 +46
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 1062 1108 +46
Misses 57 57
Partials 0 0
|
color, | ||
fluid, | ||
raised, | ||
...rest, |
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.
We have another propUtil
to get the rest
:
import { getUnhandledProps } from '../../utils/propUtils'
const rest = getUnhandledProps(Card, props)
This is needed since we might not always destructure all the props when using ...rest
. Especially when there are multiple render methods. The util creates an object of all the props that your component does not handle (i.e. the rest of the user's props).
89c71eb
to
37877e5
Compare
a099621
to
b4945d2
Compare
'in', | ||
'upstate', | ||
'New', | ||
'York.'].join(' ') |
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.
This strikes me as strange, can we use a regular string here? If we're fighting max column issues, we can put more content on a single line:
const description = [
'Amy is a violinist with 2 years experience in the wedding industry.',
'She enjoys the outdoors and currently resides in upstate New York.',
].join(' ')
Before I also forget, here's a reminder to mark the "Card" off in the README.md support table. |
b0ed621
to
951e6e1
Compare
@athurman bump:
|
header='Elliot Baker' | ||
meta='Friend' | ||
description='Elliot is a sound engineer living in Nashville who enjoys playing guitar and hanging with his cat.' | ||
/> |
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 shorthand examples where there are no nodes between the Card and Content, let's just put the props on the Card:
<Card
href='#link'
header='Elliot Baker'
meta='Friend'
description='Elliot is a sound engineer living in Nashville who enjoys playing guitar and hanging with his cat.'
/>
f443729
to
dd2793b
Compare
meta='Friend' | ||
description='Elliot is a sound engineer living in Nashville who enjoys playing guitar and hanging with his cat.' | ||
/> | ||
</Card> |
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.
To assist with the docs, let's separate the shorthand props examples into separate files. This way there are two descriptions and two code blocks. It also removes the need for the extra div wrapper.
See this thread for more context and an example: https://github.com/TechnologyAdvice/stardust/pull/344#discussion_r74117525
dd2793b
to
4ea78fe
Compare
bbecc1b
to
e966d1f
Compare
|
||
const LinkCard = () => ( | ||
<Card | ||
href='#link' |
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.
Whoops, no #
when defining an href
.
Oh, I see, this is going to link to the example of the same name. In the future, prefer empty #
to linking to actual anchors. No need to update. 👍
e966d1f
to
52ac7b6
Compare
52ac7b6
to
e855252
Compare
e855252
to
4035e0d
Compare
Released in |
Adds Card component to v1 API
http://semantic-ui.com/views/card.html
Types
Fluid Card
Centered Card
Raised Card
Link Card
Colored Card
Cards
A group of cards
Column Count
defines how many cards should exist in a row
Stackable
Doubling