Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: correção de componente Text, Input e Button #37

Merged
merged 4 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/docs/src/stories/Input/Root.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default {
status: {
control: { type: 'select' },
description: 'Define o status do input',
options: [undefined, 'error', 'success'],
options: ['default', 'error', 'success'],
table: {
type: {
summary: ['error', 'success'].join('|'),
summary: ['default', 'error', 'success'].join('|'),
},
},
type: { name: 'string', required: false },
Expand Down
24 changes: 24 additions & 0 deletions apps/docs/src/stories/Text.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meta, StoryObj } from '@storybook/react'
import { User } from 'phosphor-react'

import { Text, TextProps } from '@coaktion/visu'

Expand Down Expand Up @@ -73,6 +74,14 @@ export default {
},
type: { name: 'boolean', required: false },
},
inline: {
control: { type: 'boolean' },
description: 'Adiciona flex inline ao texto',
table: {
type: { summary: 'boolean' },
},
type: { name: 'boolean', required: false },
},
link: {
control: { type: 'select' },
description:
Expand Down Expand Up @@ -109,6 +118,21 @@ export default {

export const Comum: StoryObj<TextProps> = {}

export const ComIcone: StoryObj<TextProps> = {
argTypes: {
children: {
control: 'none',
},
},
args: {
children: (
<>
<User /> Username
</>
),
},
}

export const ComoTagAnchor: StoryObj<TextProps> = {
argTypes: {
children: {
Expand Down
4 changes: 4 additions & 0 deletions packages/visu/src/library/Button/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export const RootStyle = css({
true: {
width: '100%',
},
false: {
width: 'fit-content',
},
},
},
compoundVariants: [
Expand Down Expand Up @@ -178,5 +181,6 @@ export const RootStyle = css({
defaultVariants: {
size: 'md',
variant: 'primary',
full: false,
},
})
1 change: 1 addition & 0 deletions packages/visu/src/library/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const InputIcon = ({
ref={IconComponent}
clickable={!!onClick}
onClick={handleClick}
type="button"
{...rest}
>
{children}
Expand Down
10 changes: 6 additions & 4 deletions packages/visu/src/library/Input/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ export const Root = styled('div', {
gap: '$3',
width: 'fit-content',
padding: '0 $4',

color: '$gray500',

border: '1px solid $gray500',
borderRadius: '$md',

cursor: 'text',

'&:focus-within': {
Expand All @@ -97,6 +93,9 @@ export const Root = styled('div', {
success: {
border: '1px solid $success',
},
default: {
border: '1px solid $gray500',
},
},
disabled: {
true: {
Expand All @@ -111,4 +110,7 @@ export const Root = styled('div', {
},
},
},
defaultVariants: {
status: 'default',
},
})
2 changes: 2 additions & 0 deletions packages/visu/src/library/Text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const Text = ({
size,
weight,
underline,
inline,
...rest
}: TextProps): JSX.Element => {
const Component = asChild ? Slot : 'span'
Expand All @@ -45,6 +46,7 @@ const Text = ({
size,
weight,
underline,
inline,
})}
{...rest}
>
Expand Down
14 changes: 14 additions & 0 deletions packages/visu/src/library/Text/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { css } from '@library'

export const Root = css({
transition: '$normal all',
fontSize: 'inherit',

'& *': {
fontSize: 'inherit',
verticalAlign: 'middle',
},

variants: {
underline: {
Expand Down Expand Up @@ -33,6 +39,14 @@ export const Root = css({
fontSize: '$3xl',
},
},
inline: {
true: {
display: 'inline-flex',
gap: '$1',
flexWrap: 'wrap',
alignItems: 'center',
},
},
weight: {
light: {
fontWeight: '300',
Expand Down