Skip to content

Commit

Permalink
Added a small (size=“s”) version of the EuiCallOut
Browse files Browse the repository at this point in the history
  • Loading branch information
cchaos committed Jan 8, 2018
1 parent 2de627d commit 8603bd7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src-docs/src/views/call_out/call_out_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ export const CallOutExample = {
code: infoHtml,
}],
text: (
<p>
Use <EuiCode>EuiCallOut</EuiCode> to communicate general information to the user.
Note that the <EuiCode>Icon</EuiCode> prop is optional.
</p>
<div>
<p>
Use <EuiCode>EuiCallOut</EuiCode> to communicate general information to the user.
Note that the <EuiCode>Icon</EuiCode> prop is optional.
</p>
<p>
For callouts that have a perminant spot in the UI, but need to be less obstructive,
set the <EuiCode>size</EuiCode> property to <EuiCode>s</EuiCode> (small).
</p>
</div>
),
demo: <Info />,
}, {
Expand Down
9 changes: 9 additions & 0 deletions src-docs/src/views/call_out/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,14 @@ export default () => (
title="Callouts can exist as just a title. Simply omit the child content."
iconType="gear"
/>

<EuiSpacer size="m" />

<EuiCallOut
size="s"
title="This is a small callout for more unintrusive but constant messages."
iconType="pin"
/>

</div>
);
9 changes: 9 additions & 0 deletions src/components/call_out/_call_out.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.euiCallOut {
padding: $euiSize;
border-left: $euiSizeXS / 2 solid transparent;

&.euiCallOut--small {
padding: $euiSizeS;
}
}

// Modifier naming and colors.
Expand Down Expand Up @@ -46,6 +50,11 @@ $callOutTypes: (
> * + * {
margin-left: $euiSizeS; /* 3 */
}

// smaller font size for headers in small callout
.euiCallOut--small & {
@include euiFontSizeS;
}
}

/**
Expand Down
17 changes: 16 additions & 1 deletion src/components/call_out/call_out.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,28 @@ const colorToClassNameMap = {

export const COLORS = Object.keys(colorToClassNameMap);

const sizeToClassNameMap = {
s: 'euiCallOut--small',
m: '',
};

export const SIZES = Object.keys(sizeToClassNameMap);

export const EuiCallOut = ({
title,
color,
size,
iconType,
children,
className,
...rest
}) => {
const classes = classNames('euiCallOut', colorToClassNameMap[color], className);
const classes = classNames(
'euiCallOut',
colorToClassNameMap[color],
sizeToClassNameMap[size],
className,
);

let headerIcon;

Expand Down Expand Up @@ -77,8 +90,10 @@ EuiCallOut.propTypes = {
title: PropTypes.node,
iconType: PropTypes.oneOf(ICON_TYPES),
color: PropTypes.oneOf(COLORS),
size: PropTypes.oneOf(SIZES),
};

EuiCallOut.defaultProps = {
color: 'primary',
size: 'm',
};

0 comments on commit 8603bd7

Please sign in to comment.