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

Callouts can be title only #10

Merged
merged 1 commit into from
Oct 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 22 additions & 12 deletions docs/src/views/call_out/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@ import React from 'react';
import {
KuiCallOut,
KuiLink,
KuiSpacer,
} from '../../../../src/components';

export default () => (
<KuiCallOut
title="Check it out, here's a really long title that will wrap within a narrower browser"
iconType="search"
>
<p>
Here&rsquo;s some stuff that you need to know. We can make this text really long so that,
when viewed within a browser that&rsquo;s fairly narrow, it will wrap, too.
</p>
<p>
And some other stuff on another line, just for kicks. And <KuiLink href="#">here&rsquo;s a link</KuiLink>.
</p>
</KuiCallOut>
<div>
<KuiCallOut
title="Check it out, here's a really long title that will wrap within a narrower browser"
iconType="search"
>
<p>
Here&rsquo;s some stuff that you need to know. We can make this text really long so that,
when viewed within a browser that&rsquo;s fairly narrow, it will wrap, too.
</p>
<p>
And some other stuff on another line, just for kicks. And <KuiLink href="#">here&rsquo;s a link</KuiLink>.
</p>
</KuiCallOut>

<KuiSpacer size="m" />

<KuiCallOut
title="Callouts can exist as just a title. Simply omit the child content."
iconType="gear"
/>
</div>
);
13 changes: 10 additions & 3 deletions src/components/call_out/call_out.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ export const KuiCallOut = ({ title, type, iconType, children, className, ...rest
);
}

let optionalChildren;
if (children) {
optionalChildren = (
<KuiText size="s">
{children}
</KuiText>
);
}

return (
<div
className={classes}
Expand All @@ -50,9 +59,7 @@ export const KuiCallOut = ({ title, type, iconType, children, className, ...rest
</span>
</div>

<KuiText size="s">
{children}
</KuiText>
{optionalChildren}
</div>
);
};
Expand Down