-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
518 additions
and
3 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
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,29 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiCard, | ||
EuiIcon, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '../../../../src/components'; | ||
|
||
const icons = ['Beats', 'Cloud', 'Xpack', 'Kibana']; | ||
|
||
const cardNodes = icons.map(function (item, index) { | ||
return ( | ||
<EuiFlexItem key={index}> | ||
<EuiCard | ||
icon={<EuiIcon size="xxl" type={`logo${item}`} />} | ||
title={`Elastic ${item}`} | ||
description="Example of a card's description. Stick to one or two sentences." | ||
onClick={() => window.alert('Card clicked')} | ||
/> | ||
</EuiFlexItem> | ||
); | ||
}); | ||
|
||
export default () => ( | ||
<EuiFlexGroup gutterSize="l"> | ||
{cardNodes} | ||
</EuiFlexGroup> | ||
); |
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,95 @@ | ||
import React from 'react'; | ||
|
||
import { renderToHtml } from '../../services'; | ||
|
||
import { | ||
GuideSectionTypes, | ||
} from '../../components'; | ||
|
||
import { | ||
EuiCode, | ||
EuiCard, | ||
} from '../../../../src/components'; | ||
|
||
import Card from './card'; | ||
const cardSource = require('!!raw-loader!./card'); | ||
const cardHtml = renderToHtml(Card); | ||
|
||
import CardImage from './card_image'; | ||
const cardImageSource = require('!!raw-loader!./card_image'); | ||
const cardImageHtml = renderToHtml(CardImage); | ||
|
||
import CardFooter from './card_footer'; | ||
const cardFooterSource = require('!!raw-loader!./card_footer'); | ||
const cardFooterHtml = renderToHtml(CardFooter); | ||
|
||
export const CardExample = { | ||
title: 'Card', | ||
sections: [{ | ||
title: 'Basic Card', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: cardSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: cardHtml, | ||
}], | ||
text: ( | ||
<div> | ||
<p> | ||
At it's core an <EuiCode>EuiCard</EuiCode> should contain a <EuiCode>title</EuiCode>, | ||
<EuiCode>description</EuiCode>, and an <EuiCode>icon</EuiCode>. You can make the whole card | ||
clickable by giving it an <EuiCode>onClick</EuiCode> handler. | ||
</p> | ||
<p> | ||
By default a card's content is center aligned. To change the alignment | ||
set <EuiCode>textAlign</EuiCode> to <EuiCode>left</EuiCode> or <EuiCode>right</EuiCode>. | ||
</p> | ||
</div> | ||
), | ||
props: { EuiCard }, | ||
demo: <Card />, | ||
}, | ||
{ | ||
title: 'Images', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: cardImageSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: cardImageHtml, | ||
}], | ||
text: ( | ||
<div> | ||
<p> | ||
Images can be added in place of, or in conjuction with, icons. | ||
Just pass a url into the <EuiCode>image</EuiCode> prop and it will expand to to edges of the card. | ||
</p> | ||
<p> | ||
Make sure that all images are the <strong>same proportions</strong> when used in a singular row. | ||
</p> | ||
</div> | ||
), | ||
components: { EuiCard }, | ||
demo: <CardImage />, | ||
}, | ||
{ | ||
title: 'Footer', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: cardFooterSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: cardFooterHtml, | ||
}], | ||
text: ( | ||
<p> | ||
Footers can contain any number of elements and will always align to the bottom of the card. | ||
However, if you supply a footer containing a <EuiCode>EuiButton</EuiCode> you <strong>must not</strong> also | ||
give it an <EuiCode>onClick</EuiCode>. | ||
</p> | ||
), | ||
components: { EuiCard }, | ||
demo: <CardFooter />, | ||
}], | ||
}; |
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,51 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiButton, | ||
EuiCard, | ||
EuiIcon, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiLink, | ||
EuiSpacer, | ||
EuiText, | ||
} from '../../../../src/components'; | ||
|
||
const cardFooterContent = ( | ||
<div> | ||
<EuiButton>Go for it</EuiButton> | ||
<EuiSpacer size="xs"/> | ||
<EuiText size="s"> | ||
<p>Or try <EuiLink>this</EuiLink></p> | ||
</EuiText> | ||
</div> | ||
); | ||
|
||
export default () => ( | ||
<EuiFlexGroup gutterSize="l"> | ||
<EuiFlexItem> | ||
<EuiCard | ||
icon={<EuiIcon size="xxl" type="devToolsApp" />} | ||
title="Developers Tools" | ||
description="Example of a short card description." | ||
footer={cardFooterContent} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiCard | ||
icon={<EuiIcon size="xxl" type="dashboardApp" />} | ||
title="Dashboards" | ||
description="Example of a short longer card description. See how the footers stay lined up." | ||
footer={cardFooterContent} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiCard | ||
icon={<EuiIcon size="xxl" type="savedObjectsApp" />} | ||
title="Save Objects" | ||
description="Example of a short card description." | ||
footer={cardFooterContent} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); |
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,50 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiButton, | ||
EuiCard, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiIcon, | ||
} from '../../../../src/components'; | ||
|
||
const cardFooterContent = ( | ||
<EuiFlexGroup justifyContent="flexEnd"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton>Go for it</EuiButton> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
|
||
export default () => ( | ||
<EuiFlexGroup gutterSize="l"> | ||
<EuiFlexItem> | ||
<EuiCard | ||
textAlign="left" | ||
image="https://source.unsplash.com/400x200/?Nature" | ||
title="Elastic in Nature" | ||
description="Example of a card's description. Stick to one or two sentences." | ||
footer={cardFooterContent} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiCard | ||
textAlign="left" | ||
image="https://source.unsplash.com/400x200/?Water" | ||
title="Elastic in Water" | ||
description="Example of a card's description. Stick to one or two sentences." | ||
footer={cardFooterContent} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiCard | ||
textAlign="left" | ||
image="https://source.unsplash.com/400x200/?City" | ||
icon={<EuiIcon size="xxl" type="logoBeats" />} | ||
title={`Beats in the City`} | ||
description="Example of a card's description. Stick to one or two sentences." | ||
footer={cardFooterContent} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); |
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,11 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiPanel, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<EuiPanel onClick={() => window.alert('Panel clicked')}> | ||
<p>Hover me to see my hover state.</p> | ||
</EuiPanel> | ||
); |
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 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiCard is rendered 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="euiPanel euiPanel--paddingMedium euiCard euiCard--centerAligned euiCard--textAlign testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
> | ||
<div | ||
class="euiCard__top" | ||
/> | ||
<div | ||
class="euiCard__content" | ||
> | ||
<span | ||
class="euiTitle euiTitle--small euiCard__title" | ||
> | ||
Card title | ||
</span> | ||
<div | ||
class="euiText euiText--small euiCard__description" | ||
> | ||
<p> | ||
Card description | ||
</p> | ||
</div> | ||
</div> | ||
<div | ||
class="euiCard__footer" | ||
/> | ||
</div> | ||
`; |
Oops, something went wrong.