-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(carousel): add controls small & large
- Loading branch information
Showing
5 changed files
with
260 additions
and
86 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
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
46 changes: 46 additions & 0 deletions
46
packages/components/src/components/bal-carousel/controls/large-control.tsx
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,46 @@ | ||
import { FunctionalComponent, h } from '@stencil/core' | ||
import { BEM } from '../../../utils/bem' | ||
|
||
export interface LargeControlProps { | ||
isFirst: boolean | ||
isLast: boolean | ||
onPreviousClick: () => void | ||
onNextClick: () => void | ||
} | ||
|
||
export const LargeControl: FunctionalComponent<LargeControlProps> = ({ | ||
isFirst, | ||
isLast, | ||
onNextClick, | ||
onPreviousClick, | ||
}) => { | ||
const block = BEM.block('carousel') | ||
const controls = block.element('controls') | ||
const button = controls.element('button') | ||
|
||
return ( | ||
<div | ||
class={{ | ||
...controls.class(), | ||
...controls.modifier('large').class(), | ||
}} | ||
> | ||
<bal-button | ||
class={{ ...button.class(), ...button.modifier('left').class() }} | ||
square | ||
icon="nav-go-left" | ||
rounded | ||
onClick={() => onPreviousClick()} | ||
disabled={isFirst} | ||
></bal-button> | ||
<bal-button | ||
class={{ ...button.class(), ...button.modifier('right').class() }} | ||
square | ||
icon="nav-go-right" | ||
rounded | ||
onClick={() => onNextClick()} | ||
disabled={isLast} | ||
></bal-button> | ||
</div> | ||
) | ||
} |
56 changes: 56 additions & 0 deletions
56
packages/components/src/components/bal-carousel/controls/small-control.tsx
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,56 @@ | ||
import { FunctionalComponent, h } from '@stencil/core' | ||
import { BEM } from '../../../utils/bem' | ||
|
||
export interface SmallControlProps { | ||
isFirst: boolean | ||
isLast: boolean | ||
onPreviousClick: () => void | ||
onNextClick: () => void | ||
} | ||
|
||
export const SmallControl: FunctionalComponent<SmallControlProps> = ({ | ||
isFirst, | ||
isLast, | ||
onNextClick, | ||
onPreviousClick, | ||
}) => { | ||
const block = BEM.block('carousel') | ||
const controls = block.element('controls') | ||
const button = controls.element('button') | ||
|
||
return ( | ||
<div | ||
class={{ | ||
...controls.class(), | ||
...controls.modifier('small').class(), | ||
}} | ||
> | ||
<bal-button | ||
class={{ | ||
...button.class(), | ||
...button.modifier('left').class(), | ||
...button.modifier('hidden').class(isFirst), | ||
}} | ||
square | ||
size="small" | ||
icon="nav-go-left" | ||
rounded | ||
onClick={() => onPreviousClick()} | ||
disabled={isFirst} | ||
></bal-button> | ||
<bal-button | ||
class={{ | ||
...button.class(), | ||
...button.modifier('right').class(), | ||
...button.modifier('hidden').class(isLast), | ||
}} | ||
square | ||
size="small" | ||
icon="nav-go-right" | ||
rounded | ||
onClick={() => onNextClick()} | ||
disabled={isLast} | ||
></bal-button> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.