Skip to content

Commit

Permalink
feat(html): add rounded prop to button-group
Browse files Browse the repository at this point in the history
  • Loading branch information
Juveniel committed Apr 29, 2024
1 parent 586e93e commit 7730838
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
11 changes: 8 additions & 3 deletions packages/html/src/button-group/button-group.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { classNames, optionClassNames, stateClassNames, States, FillMode } from '../misc';
import { classNames, optionClassNames, stateClassNames, States, Roundness, FillMode } from '../misc';

export const BUTTONGROUP_CLASSNAME = `k-button-group`;

Expand All @@ -8,10 +8,12 @@ const states = [

const options = {
fillMode: [ FillMode.solid, FillMode.flat, FillMode.outline, FillMode.clear, FillMode.link ],
rounded: [ Roundness.small, Roundness.medium, Roundness.large, Roundness.full ]
};

export type KendoButtonGroupOptions = {
fillMode?: (typeof options.fillMode)[number] | null;
rounded?: (typeof options.rounded)[number] | null;
};

export type KendoButtonGroupProps = KendoButtonGroupOptions & {
Expand All @@ -21,7 +23,8 @@ export type KendoButtonGroupProps = KendoButtonGroupOptions & {
export type KendoButtonGroupState = { [K in (typeof states)[number]]?: boolean };

const defaultProps = {
fillMode: FillMode.solid
fillMode: FillMode.solid,
rounded: Roundness.medium
};

export const ButtonGroup = (
Expand All @@ -31,6 +34,7 @@ export const ButtonGroup = (
) => {
const {
fillMode = defaultProps.fillMode,
rounded = defaultProps.rounded,
disabled,
stretched,
...other
Expand All @@ -43,7 +47,8 @@ export const ButtonGroup = (
props.className,
BUTTONGROUP_CLASSNAME,
optionClassNames(BUTTONGROUP_CLASSNAME, {
fillMode
fillMode,
rounded
}),
stateClassNames(BUTTONGROUP_CLASSNAME, {
disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonGroup } from "../button-group.spec";
import { Button } from "../../button";

export const IconButtonGroup = (props) => (
<ButtonGroup children={
<ButtonGroup {...props} children={
<>
<Button className="k-group-start" {...props} icon="bold" />
<Button {...props} icon="italic" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonGroup } from "../button-group.spec";
import { Button } from "../../button";

export const IconTextButtonGroup = (props) => (
<ButtonGroup children={
<ButtonGroup {...props} children={
<>
<Button className="k-group-start" {...props} icon="star">First</Button>
<Button {...props} icon="star">Middle</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonGroup } from "../button-group.spec";
import { Button } from "../../button";

export const MixedButtonGroup = (props) => (
<ButtonGroup children={
<ButtonGroup {...props} children={
<>
<Button className="k-group-start" {...props}>First</Button>
<Button {...props} icon="star">Middle</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ButtonGroup } from "../button-group.spec";
import { Button } from "../../button";

export const TextButtonGroup = (props) => (
<ButtonGroup children={
<ButtonGroup {...props} children={
<>
<Button className="k-group-start" {...props}>First</Button>
<Button {...props}>Middle</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default () => (
<span>medium</span>
<span>large</span>

{[ "null", ...Button.options.rounded ].map((rounded: any) => (
{[ "null", ...Button.options.rounded ].map((rounded) => (
<>
<span>{rounded}</span>
{Button.options.size.map((size) => (
Expand Down

0 comments on commit 7730838

Please sign in to comment.