Skip to content

Commit

Permalink
feat(html): add fab-items helper
Browse files Browse the repository at this point in the history
  • Loading branch information
epetrow authored and Juveniel committed Mar 28, 2023
1 parent 2d25d06 commit 1a99f9c
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 250 deletions.
48 changes: 48 additions & 0 deletions packages/html/src/fab/fab-item.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as React from 'react';
import { classNames } from '../utils';
import { Icon } from '../icon';

export interface FloatingActionButtonItemProps {
className?: string;
align?: 'left' | 'right';
text?: string;
icon?: string;
hover?: boolean;
focus?: boolean;
active?: boolean;
disabled?: boolean;
}

export class FloatingActionButtonItem extends React.Component<FloatingActionButtonItemProps> {

render() {
const {
className,
align,
text,
icon,
hover,
focus,
active,
disabled
} = this.props;

return (
<li className={classNames(
className,
'k-fab-item',
{
[`k-text-${align}`]: align,
'k-hover': hover,
'k-focus': focus,
'k-active': active,
'k-disabled': disabled
}
)}>
<span className="k-fab-item-text">{text}</span>
<Icon className="k-fab-item-icon" name={icon} />
</li>
);

}
}
32 changes: 32 additions & 0 deletions packages/html/src/fab/fab-items.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as React from 'react';
import { classNames } from '../utils';

export interface FloatingActionButtonItemsProps {
className?: string;
position?: null | 'top' | 'bottom';
children?: React.ReactNode;
}

export class FloatingActionButtonItems extends React.Component<FloatingActionButtonItemsProps> {

render() {
const {
className,
position,
children
} = this.props;

return (
<ul className={classNames(
className,
'k-fab-items',
{
[`k-fab-items-${position}`]: position
}
)}>
{children}
</ul>
);

}
}
2 changes: 2 additions & 0 deletions packages/html/src/fab/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './fab';
export * from './fab-items';
export * from './fab-item';
Loading

0 comments on commit 1a99f9c

Please sign in to comment.