-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Tag): add Tag to @carbon/styles (#9131)
* feat(Tag): add Tag to @carbon/styles * feat(Tag): add Tag to @carbon/styles * feat(Tag): add tag sass module * feat(Tag): add tag sass module * feat(Tag): fix broken color token imports * feat(Tag): add type includes * fix(Tag): remove debug, meta calls; pr fixes Co-authored-by: TJ Egan <[email protected]>
- Loading branch information
Showing
10 changed files
with
1,097 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// Copyright IBM Corp. 2018, 2018 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/tag'; |
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,47 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2018 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Tag } from 'carbon-components-react'; | ||
|
||
export default { | ||
title: 'Components/Tag', | ||
parameters: { | ||
component: Tag, | ||
}, | ||
}; | ||
|
||
export const Default = () => { | ||
return ( | ||
<> | ||
<Tag className="some-class" type="red" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
<Tag className="some-class" type="magenta" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
<Tag className="some-class" type="purple" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
<Tag className="some-class" type="blue" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
<Tag className="some-class" type="cyan" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
<Tag className="some-class" type="teal" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
<Tag className="some-class" type="green" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
<Tag className="some-class" type="gray" size="sm" title="Clear Filter"> | ||
{'Tag content'} | ||
</Tag> | ||
</> | ||
); | ||
}; |
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,8 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2018 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
export { Tag } from 'carbon-components-react'; |
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,25 @@ | ||
/** | ||
* Copyright IBM Corp. 2018, 2018 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @jest-environment node | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const { SassRenderer } = require('@carbon/test-utils/scss'); | ||
|
||
const { render } = SassRenderer.create(__dirname); | ||
|
||
describe('scss/components/tag', () => { | ||
test('Public API', async () => { | ||
const { unwrap } = await render(` | ||
@use 'sass:meta'; | ||
@use '../tag/tag'; | ||
$_: get('mixin', meta.mixin-exists('tag', 'tag')); | ||
`); | ||
expect(unwrap('mixin')).toBe(true); | ||
}); | ||
}); |
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,12 @@ | ||
// | ||
// Copyright IBM Corp. 2018, 2018 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@forward 'tag'; | ||
@forward 'tokens'; | ||
@use 'tag'; | ||
|
||
@include tag.tag; |
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,21 @@ | ||
// | ||
// Copyright IBM Corp. 2016, 2018 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
@use '../../config' as *; | ||
|
||
/// @access private | ||
/// @group tag | ||
@mixin tag-theme($bg-color, $text-color, $filter-hover-color: $bg-color) { | ||
background-color: $bg-color; | ||
color: $text-color; | ||
|
||
&.#{$prefix}--tag--interactive, | ||
.#{$prefix}--tag__close-icon { | ||
&:hover { | ||
background-color: $filter-hover-color; | ||
} | ||
} | ||
} |
Oops, something went wrong.