Skip to content

Commit

Permalink
feat: update input according v3theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Esthefanie Vila Maior committed Mar 20, 2024
1 parent f2472b2 commit 2c76467
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 10 deletions.
8 changes: 8 additions & 0 deletions packages/yoga/src/Input/Input.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const Input = ({
colors,
fontSizes,
fontWeights,
lineHeights,
borders,
radii,
spacing,
Expand All @@ -15,6 +16,7 @@ const Input = ({
},
size: fontSizes.small,
weight: fontWeights.regular,
lineHeight: lineHeights.small,
},
border: {
width: borders.small,
Expand Down Expand Up @@ -45,6 +47,10 @@ const Input = ({
typed: fontSizes.xsmall,
},
weight: fontWeights.regular,
lineHeight: {
default: lineHeights.small,
typed: lineHeights.xsmall,
},
},
},
helper: {
Expand All @@ -57,6 +63,8 @@ const Input = ({
},
font: {
size: fontSizes.xsmall,
weight: fontWeights.regular,
lineHeight: lineHeights.xsmall,
},
},
});
Expand Down
3 changes: 2 additions & 1 deletion packages/yoga/src/Input/web/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const labelTransition = css`
transition-timing-function: cubic-bezier(${transition.timing[0].join()});
font-size: ${input.label.font.size.typed}px;
line-height: ${input.label.font.lineHeight.typed}px;
`}
`;

Expand Down Expand Up @@ -61,6 +62,7 @@ const Field = styled.input`
font-family: ${baseFont.family}, sans-serif;
font-size: ${input.font.size}px;
font-weight: ${input.font.weight};
line-height: ${input.font.lineHeight}px;
&:focus {
color: ${input.font.color.focus};
Expand All @@ -74,7 +76,6 @@ const Field = styled.input`
& ~ label {
${labelTransition}
font-weight: ${input.label.font.weight};
color: ${error
? `${colors.feedback.attention[1]}`
: `${colors.text.primary}`};
Expand Down
6 changes: 3 additions & 3 deletions packages/yoga/src/Input/web/Fieldset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ const Fieldset = styled.fieldset`
${disabled ? `border-color: ${colors.elements.lineAndBorders};` : ''}
&:hover, &:focus-within {
&:hover, &:focus-within {
&:not(:disabled) {
border-color: ${
error ? colors.feedback.attention[1] : input.border.color.typed
};
}
}
}
`}
`;

Expand Down
8 changes: 3 additions & 5 deletions packages/yoga/src/Input/web/Helper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ export const Wrapper = styled.div`
`}
`;

const Info = styled(Text.Small)`
const Info = styled(Text.Body2)`
color: currentColor;
${({
hideMaxLength,
theme: {
yoga: {
components: { input },
},
yoga: { baseFont },
},
}) => `
font-size: ${input.helper.font.size}px;
font-family: ${baseFont.family};
${hideMaxLength ? 'display: none;' : ''}
`}
Expand Down
3 changes: 3 additions & 0 deletions packages/yoga/src/Input/web/Label.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ const Label = styled.label`
yoga: {
transition,
colors,
baseFont,
components: { input },
},
},
}) => css`
top: ${input.padding.top}px;
left: ${input.padding.left}px;
font-family: ${baseFont.family};
font-size: ${input.label.font.size.default}px;
font-weight: ${input.label.font.weight};
line-height: ${input.label.font.lineHeight.default}px;
color: ${input.label.color.default};
transition-property: transform, font-size;
Expand Down
5 changes: 4 additions & 1 deletion packages/yoga/src/Input/web/Legend.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ const StyledLegend = styled.legend`
max-width: 0;
width: auto;
height: 0;
font-weight: normal;
visibility: hidden;
transition-property: max-width, padding;
${({
theme: {
yoga: {
baseFont,
components: { input },
},
},
}) => `
font-family: ${baseFont.family};
font-size: ${input.label.font.size.typed}px;
font-weight: ${input.label.font.weight};
line-height: ${input.label.font.lineHeight.typed}px;
letter-spacing: normal;
transition-duration: 100ms;
Expand Down
27 changes: 27 additions & 0 deletions packages/yoga/src/Theme/theme/v3theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,32 @@ export const v3theme = createTheme(tokens => ({
}
},
},
input: {
font: {
size: tokens.fontSizes.small,
weight: tokens.fontWeights.medium,
lineHeight: tokens.lineHeights.small,
},
label: {
font: {
size: {
default: tokens.fontSizes.small,
typed: tokens.fontSizes.xsmall,
},
weight: tokens.fontWeights.medium,
lineHeight: {
default: tokens.lineHeights.small,
typed: tokens.lineHeights.xsmall,
},
},
},
helper: {
font: {
size: tokens.fontSizes.xsmall,
weight: tokens.fontWeights.regular,
lineHeight: tokens.lineHeights.xsmall,
},
},
},
},
}));

0 comments on commit 2c76467

Please sign in to comment.