-
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.
- Loading branch information
Showing
18 changed files
with
217 additions
and
42 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
33 changes: 33 additions & 0 deletions
33
packages/components/src/components/bal-close/bal-close.scss
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,33 @@ | ||
@import './bal-close.vars.scss'; | ||
|
||
bal-close { | ||
position: static; | ||
display: inline-block; | ||
cursor: pointer; | ||
flex-grow: 0; | ||
flex-shrink: 0; | ||
outline: 0; | ||
|
||
.delete:not(.has-background) { | ||
background: transparent; | ||
} | ||
|
||
.delete:not(.is-inverted) { | ||
&::before, | ||
&::after { | ||
background: $blue; | ||
} | ||
|
||
&:focus { | ||
background: transparent; | ||
} | ||
|
||
&:hover { | ||
background: $blue-1; | ||
} | ||
|
||
&:active { | ||
background: $blue-2; | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
packages/components/src/components/bal-close/bal-close.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,40 @@ | ||
import { Component, h, ComponentInterface, Host, Element, Prop } from '@stencil/core' | ||
|
||
@Component({ | ||
tag: 'bal-close', | ||
}) | ||
export class Close implements ComponentInterface { | ||
@Element() el!: HTMLElement | ||
|
||
/** | ||
* Define the size of badge. Small is recommended for tabs. | ||
*/ | ||
@Prop() size: 'small' | 'large' | 'medium' | '' = '' | ||
|
||
/** | ||
* If `true` it supports dark backgrounds. | ||
*/ | ||
@Prop() inverted = false | ||
|
||
/** | ||
* If `true` it has a light background. | ||
*/ | ||
@Prop() background = false | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<button | ||
tabIndex={-1} | ||
aria-label="close" | ||
class={{ | ||
'delete': true, | ||
'is-inverted': this.inverted, | ||
'has-background': this.background, | ||
[`is-${this.size}`]: this.size !== '', | ||
}} | ||
></button> | ||
</Host> | ||
) | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/components/src/components/bal-close/bal-close.vars.scss
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,3 @@ | ||
// define variables for your component here with !default. | ||
|
||
// $close-color: $text !default; |
24 changes: 24 additions & 0 deletions
24
packages/components/src/components/bal-close/stories/bal-close.docs.mdx
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,24 @@ | ||
import { Story, Canvas, Description } from '@storybook/addon-docs' | ||
import readme from '../readme.md' | ||
|
||
<span id="story--components-close--basic" style={{ opacity: 0 }}></span> | ||
|
||
# Close | ||
|
||
Todo add some description to the component and its purpose | ||
|
||
<Canvas> | ||
<Story id="components-close--basic" /> | ||
</Canvas> | ||
|
||
## Component Api | ||
|
||
<Description markdown={readme} /> | ||
|
||
<br /> | ||
|
||
import testing from './testing.md' | ||
|
||
<Description markdown={testing} /> | ||
|
||
<bal-doc-github link="/components/bal-close/stories/bal-close.docs.mdx"></bal-doc-github> |
19 changes: 19 additions & 0 deletions
19
packages/components/src/components/bal-close/stories/bal-close.stories.ts
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,19 @@ | ||
import docs from './bal-close.docs.mdx' | ||
import { BalComponentStory } from '../../../stories/utils' | ||
import { BalClose } from '../../../../.storybook/vue/components' | ||
|
||
const component = BalComponentStory({ | ||
title: 'Components/Close', | ||
component: BalClose, | ||
docs, | ||
}) | ||
|
||
export default component.story | ||
|
||
export const Basic = args => ({ | ||
components: { ...component.components }, | ||
setup: () => ({ args }), | ||
template: `<bal-close v-bind="args"></bal-close>`, | ||
}) | ||
Basic.args = {} | ||
Basic.parameters = { ...component.sourceCode(Basic) } |
Empty file.
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
Oops, something went wrong.