Skip to content

Commit

Permalink
Merge pull request #169 from fedspendingtransparency/mod/9962-classna…
Browse files Browse the repository at this point in the history
…mes-in-cardbutton

Mod/9962 classnames in cardbutton
  • Loading branch information
nick-torres authored Jun 14, 2023
2 parents 2df58bb + 3313ef3 commit 305cbe4
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const Button = (props) => {
}

// ANY ADDITIONAL CLASS NAMES
if (!props.additionalClassnames === '' && props.additionalClassnames !== null && props.additionalClassnames !== undefined) {
if (props.additionalClassnames) {
classNameList += ' ';
classNameList += props.additionalClassnames;
}
Expand Down
33 changes: 28 additions & 5 deletions components/cards/CardButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ const propTypes = {
};

const CardButton = ({
link, govLink, onlyPerformAction = "false", action, text, variant = "secondary", customClassName = '', children, disabled, backgroundColor, buttonSize, textAlignment
link,
govLink,
onlyPerformAction = "false",
action,
text,
variant = "secondary",
customClassName = '',
children,
disabled,
backgroundColor,
buttonSize,
textAlignment
}) => {
const variantMapper = {
primary: "primary",
Expand All @@ -50,9 +61,19 @@ const CardButton = ({
}

if (onlyPerformAction === true) {
console.log('customClassName', customClassName);
return (
<div className="card__button">
<Button onKeyUp={(e) => handleKeyUp(e)} onClick={action} copy={text || children} buttonTitle={text || children} buttonSize="md" buttonType={variantMapper[variant] === undefined ? "secondary" : variantMapper[variant]} backgroundColor="light" textAlignment="center" />
<Button
additionalClassnames={customClassName}
onKeyUp={(e) => handleKeyUp(e)}
onClick={action}
copy={text || children}
buttonTitle={text || children}
buttonSize="md"
buttonType={variantMapper[variant] === undefined ? "secondary" : variantMapper[variant]}
backgroundColor="light"
textAlignment="center" />
</div>);
}

Expand All @@ -65,6 +86,7 @@ const CardButton = ({
tabIndex="0"
aria-label={`${text}`}>
<Button
additionalClassnames={customClassName}
onClick={handleOnClick}
onKeyUp={(e) => handleKeyUp(e)}
copy={text || children}
Expand All @@ -77,23 +99,24 @@ const CardButton = ({
)
:
(
<>
<>
<div
className={`${variantMapperStyle[variant]}`}
role="button"
tabIndex="0"
aria-label={`${text}`}>
<Button
additionalClassnames={customClassName}
onClick={handleOnClick}
onKeyUp={(e) => handleKeyUp(e)}
copy={text || children}
buttonTitle={text || children}
buttonSize={buttonSize}
textAlignment={textAlignment}
buttonType={variantMapper[variant] === undefined ? "secondary" : variantMapper[variant]}
backgroundColor={backgroundColor} />
backgroundColor={backgroundColor} />
</div>
</>
</>
)}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,4 @@



window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook","files":"**/stories/*.stories.@(mdx|js)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)stories[\\\\/](?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(mdx|js))$"}];</script><script src="runtime~main.0cb46b86.iframe.bundle.js"></script><script src="211.2bd6d30e.iframe.bundle.js"></script><script src="main.f017a75c.iframe.bundle.js"></script></body></html>
window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook","files":"**/stories/*.stories.@(mdx|js)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)stories[\\\\/](?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(mdx|js))$"}];</script><script src="runtime~main.0cb46b86.iframe.bundle.js"></script><script src="211.2bd6d30e.iframe.bundle.js"></script><script src="main.5d5486e2.iframe.bundle.js"></script></body></html>
1 change: 1 addition & 0 deletions docs/main.5d5486e2.iframe.bundle.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/main.f017a75c.iframe.bundle.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"generatedAt":1686757723568,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"8.16.0"},"storybookVersion":"6.5.16","language":"typescript","storybookPackages":{"@storybook/builder-webpack5":{"version":"6.5.16"},"@storybook/manager-webpack5":{"version":"6.5.16"},"@storybook/addon-console":{"version":"1.2.3"},"@storybook/react":{"version":"6.5.16"},"@storybook/source-loader":{"version":"6.5.16"},"@storybook/theming":{"version":"6.5.16"},"storybook":{"version":"5.3.22"}},"framework":{"name":"react"},"addons":{"@storybook/addon-knobs":{"version":"6.4.0"},"@storybook/addon-docs":{"version":"6.5.16"},"@storybook/addon-a11y":{"version":"6.5.16"},"@storybook/addon-viewport":{"version":"6.5.16"},"@storybook/addon-actions":{"version":"6.5.16"},"@storybook/addon-essentials":{"version":"6.5.16"},"@storybook/addon-controls":{"version":"6.5.16"}}}
{"generatedAt":1686768368380,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"npm","version":"8.16.0"},"storybookVersion":"6.5.16","language":"typescript","storybookPackages":{"@storybook/builder-webpack5":{"version":"6.5.16"},"@storybook/manager-webpack5":{"version":"6.5.16"},"@storybook/addon-console":{"version":"1.2.3"},"@storybook/react":{"version":"6.5.16"},"@storybook/source-loader":{"version":"6.5.16"},"@storybook/theming":{"version":"6.5.16"},"storybook":{"version":"5.3.22"}},"framework":{"name":"react"},"addons":{"@storybook/addon-knobs":{"version":"6.4.0"},"@storybook/addon-docs":{"version":"6.5.16"},"@storybook/addon-a11y":{"version":"6.5.16"},"@storybook/addon-viewport":{"version":"6.5.16"},"@storybook/addon-actions":{"version":"6.5.16"},"@storybook/addon-essentials":{"version":"6.5.16"},"@storybook/addon-controls":{"version":"6.5.16"}}}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-transparency-ui",
"version": "5.6.3",
"version": "5.6.4",
"description": "Library of UI components powering Data Transparency websites",
"main": "dist/index.js",
"style": "dist/data-transparency-ui.css",
Expand Down

0 comments on commit 305cbe4

Please sign in to comment.