-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dhis2/refactor/structure-style
refactor: move all core components to widgets
- Loading branch information
Showing
235 changed files
with
263 additions
and
165 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,4 @@ cypress.env.json | |
# d2 | ||
.d2/ | ||
locales/ | ||
packages/forms/i18n/ |
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,69 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
|
||
import propTypes from '@dhis2/prop-types' | ||
|
||
import styles from './ButtonBase.styles.js' | ||
|
||
/** | ||
* @module | ||
* @param {ButtonBase.PropTypes} props | ||
* @returns {React.Component} | ||
*/ | ||
function ButtonBase( | ||
{ | ||
children, | ||
className, | ||
primary, | ||
secondary, | ||
destructive, | ||
small, | ||
large, | ||
disabled, | ||
...props | ||
}, | ||
ref | ||
) { | ||
return ( | ||
<button | ||
{...props} | ||
className={cx(className, { | ||
primary, | ||
secondary, | ||
destructive, | ||
small, | ||
large, | ||
})} | ||
disabled={disabled} | ||
ref={ref} | ||
> | ||
{children} | ||
<style jsx>{styles}</style> | ||
</button> | ||
) | ||
} | ||
|
||
/** | ||
* @typedef {Object} PropTypes | ||
* @static | ||
* @prop {Node} [children] | ||
* @prop {string} [className] | ||
* @prop {boolean} [small] | ||
* @prop {boolean} [large] | ||
* @prop {boolean } [primary] | ||
* @prop {boolean } [secondary] | ||
* @prop {boolean } [destructive] | ||
* @prop {boolean} [disabled] | ||
*/ | ||
ButtonBase.propTypes = { | ||
children: propTypes.node, | ||
className: propTypes.string, | ||
destructive: propTypes.bool, | ||
disabled: propTypes.bool, | ||
large: propTypes.bool, | ||
primary: propTypes.bool, | ||
secondary: propTypes.bool, | ||
small: propTypes.bool, | ||
} | ||
|
||
export default React.forwardRef(ButtonBase) |
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,18 @@ | ||
import React from 'react' | ||
|
||
import { ButtonBase } from './ButtonBase.js' | ||
|
||
export default { | ||
title: 'Component/Core/ButtonBase', | ||
component: ButtonBase, | ||
} | ||
|
||
export const Default = () => <ButtonBase>Default button</ButtonBase> | ||
export const Primary = () => <ButtonBase primary>Default button</ButtonBase> | ||
export const Secondary = () => <ButtonBase secondary>Default button</ButtonBase> | ||
export const Destructive = () => ( | ||
<ButtonBase destructive>Default button</ButtonBase> | ||
) | ||
export const Small = () => <ButtonBase small>Default button</ButtonBase> | ||
export const Large = () => <ButtonBase large>Default button</ButtonBase> | ||
export const Disabled = () => <ButtonBase disabled>Default button</ButtonBase> |
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
2 changes: 1 addition & 1 deletion
2
packages/forms/src/CheckboxGroupControl/CheckboxGroupControl.js
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,31 @@ | ||
import css from 'styled-jsx/css' | ||
|
||
import { spacers } from '@dhis2/ui-constants' | ||
|
||
export default css` | ||
.icon { | ||
padding-left: ${spacers.dp12}; | ||
} | ||
.icon-only.icon { | ||
padding-left: 6px; | ||
} | ||
.icon-only { | ||
padding: 0; | ||
} | ||
.icon-only i { | ||
margin-right: 0; | ||
margin-left: 0; | ||
} | ||
.button-icon { | ||
margin-right: 6px; | ||
color: inherit; | ||
fill: inherit; | ||
font-size: 26px; | ||
vertical-align: middle; | ||
pointer-events: none; | ||
} | ||
` |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.