Skip to content

Commit

Permalink
Merge branch 'main' into chore-clean-up-theming
Browse files Browse the repository at this point in the history
  • Loading branch information
e-roy committed Jul 25, 2022
2 parents 671ab3b + 4dc091e commit b1b61ac
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,15 @@
"contributions": [
"code"
]
},
{
"login": "diegoalzate",
"name": "Diego Alzate",
"avatar_url": "https://avatars.githubusercontent.com/u/22416585?v=4",
"profile": "https://github.com/diegoalzate",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# web3-ui

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-34-orange.svg?style=flat-square)](#contributors-)

[![All Contributors](https://img.shields.io/badge/all_contributors-36-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

_In Development - Refactoring in Progress 🏗️_
Expand Down Expand Up @@ -119,8 +117,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://github.com/ernestognw"><img src="https://avatars.githubusercontent.com/u/33379285?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ernesto García</b></sub></a><br /><a href="https://github.com/Developer-DAO/web3-ui/commits?author=ernestognw" title="Code">💻</a></td>
<td align="center"><a href="https://dfimbres.github.io/"><img src="https://avatars.githubusercontent.com/u/10216994?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David</b></sub></a><br /><a href="https://github.com/Developer-DAO/web3-ui/commits?author=dfimbres" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/e-roy"><img src="https://avatars.githubusercontent.com/u/70700747?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Eric Roupe</b></sub></a><br /><a href="https://github.com/Developer-DAO/web3-ui/commits?author=e-roy" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/jamescharlesworth"><img src="https://avatars.githubusercontent.com/u/666455?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James Charlesworth</b></sub></a><br /><a href="https://github.com/Developer-DAO/web3-ui/commits?author=jamescharlesworth" title="Code">💻</a></td>
<td align="center"><a href="http://seromenho.com"><img src="https://avatars.githubusercontent.com/u/476673?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ricardo Seromenho</b></sub></a><br /><a href="https://github.com/Developer-DAO/web3-ui/commits?author=seromenho" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/jamescharlesworth"><img src="https://avatars.githubusercontent.com/u/666455?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James Charlesworth</b></sub></a><br /><a href="https://github.com/Developer-DAO/web3-ui/commits?author=jamescharlesworth" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/diegoalzate"><img src="https://avatars.githubusercontent.com/u/22416585?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Diego Alzate</b></sub></a><br /><a href="https://github.com/Developer-DAO/web3-ui/commits?author=diegoalzate" title="Code">💻</a></td>
</tr>
</table>

Expand Down
42 changes: 42 additions & 0 deletions packages/components/src/elements/Badge/Badge.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';
import { Badge } from './';
import { ComponentStory, ComponentMeta } from '@storybook/react';

export default {
title: 'Elements/Badge',
component: Badge,
argTypes: {
variant: {
type: 'string',
defaultValue: 'green',
options: [
'red',
'blue',
'green',
'crimson',
'pink',
'purple',
'violet',
'indigo',
'cyan',
'teal',
'green',
'lime',
'yellow',
'orange',
'gold',
'bronze',
'gray',
'contrast',
],
control: { type: 'select' },
},
},
} as ComponentMeta<typeof Badge>;

const Template: ComponentStory<typeof Badge> = (args) => <Badge {...args} />;

export const Default = Template.bind({});
Default.args = {
children: 'Badge',
};
11 changes: 11 additions & 0 deletions packages/components/src/elements/Badge/Badge.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { render } from '@testing-library/react';

import { Badge } from './';

describe('Badge', () => {
it('renders without throwing', () => {
const { container } = render(<Badge />);
expect(container).toBeInTheDocument();
});
});
115 changes: 115 additions & 0 deletions packages/components/src/elements/Badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import { styled } from '@stitches/react';

export const Badge = styled('span', {
// Reset
alignItems: 'center',
appearance: 'none',
borderWidth: '0',
boxSizing: 'border-box',
display: 'inline-flex',
flexShrink: 0,
fontFamily: 'inherit',
justifyContent: 'center',
lineHeight: '1',
verticalAlign: 'middle',
outline: 'none',
textDecoration: 'none',
userSelect: 'none',
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
'&:disabled': {
backgroundColor: '$slate3',
pointerEvents: 'none',
color: '$slate8',
},
'&::before': {
boxSizing: 'border-box',
content: '""',
},
'&::after': {
boxSizing: 'border-box',
content: '""',
},

// Custom
backgroundColor: '$slate3',
borderRadius: '$pill',
color: '$slate11',
whiteSpace: 'nowrap',
fontVariantNumeric: 'tabular-nums',
paddingLeft: '$2',
paddingRight: '$2',
paddingTop: '$1',
paddingBottom: '$1',

variants: {
variant: {
red: {
color: '$red11',
backgroundColor: '$red3',
},
crimson: {
color: '$crimson11',
backgroundColor: '$crimson3',
},
pink: {
color: '$pink11',
backgroundColor: '$pink3',
},
purple: {
color: '$purple11',
backgroundColor: '$purple3',
},
violet: {
color: '$violet11',
backgroundColor: '$violet3',
},
indigo: {
color: '$indigo11',
backgroundColor: '$indigo3',
},
blue: {
color: '$blue11',
backgroundColor: '$blue3',
},
cyan: {
color: '$cyan11',
backgroundColor: '$cyan3',
},
teal: {
color: '$teal11',
backgroundColor: '$teal3',
},
green: {
color: '$green11',
backgroundColor: '$green3',
},
lime: {
color: '$lime11',
backgroundColor: '$lime3',
},
yellow: {
color: '$yellow11',
backgroundColor: '$yellow3',
},
orange: {
color: '$orange11',
backgroundColor: '$orange3',
},
gold: {
color: '$gold11',
backgroundColor: '$gold3',
},
bronze: {
color: '$bronze11',
backgroundColor: '$bronze3',
},
gray: {
color: '$slate11',
backgroundColor: '$slate3',
},
contrast: {
color: '$hiContrast',
},
},
},
});
1 change: 1 addition & 0 deletions packages/components/src/elements/Badge/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Badge';
1 change: 1 addition & 0 deletions packages/components/src/elements/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './Button';
export * from './Badge';
6 changes: 5 additions & 1 deletion playground/pages/web3-elements/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NextPage } from 'next';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { Text, Button } from '@web3-ui/components';
import { Text, Button, Badge } from '@web3-ui/components';

const Web3ComponentsPage: NextPage = () => {
return (
Expand All @@ -21,6 +21,10 @@ const Web3ComponentsPage: NextPage = () => {
</Text>
<Button>testing</Button>
</div>
<div className={`item`}>
<h3 className={`item-title`}>Badge</h3>
<Badge variant="lime">testing</Badge>
</div>
</div>
</main>
);
Expand Down

0 comments on commit b1b61ac

Please sign in to comment.