Skip to content

Commit

Permalink
Merge pull request #777 from gympass/DS-809
Browse files Browse the repository at this point in the history
[DS-809] Add v3theme to Dropdown component
  • Loading branch information
flavia-moraes authored Mar 22, 2024
2 parents 6783f61 + ac73e57 commit 0b3c3eb
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 56 deletions.
2 changes: 1 addition & 1 deletion packages/yoga/src/Dropdown/Dropdown.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const Dropdown = ({
font: {
color: colors.text.primary,
weight: fontWeights.medium,
size: fontSizes.medium,
size: fontSizes.small,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/yoga/src/Dropdown/native/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Selector = styled.View`
`}
`;

const Label = styled(Text)`
const Label = styled(Text.Body2)`
${({
disabled,
selected,
Expand Down
8 changes: 2 additions & 6 deletions packages/yoga/src/Dropdown/native/Options.android.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Option = styled(List.Item)`
`}
`;

const OptionText = styled.Text`
const OptionText = styled(Text.Body2)`
${({
isSelected,
theme: {
Expand Down Expand Up @@ -59,11 +59,7 @@ const Options = ({ options, selectedOption, onSelect }) => (
>
<OptionText
isSelected={selectedOption && selectedOption.value === item.value}
as={
selectedOption && selectedOption.value === item.value
? Text.Bold
: Text.Regular
}
bold={selectedOption && selectedOption.value === item.value}
>
{item.label}
</OptionText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,15 @@ exports[`<Dropdown /> Snapshots should match snapshot 1`] = `
}
>
<Text
bold={false}
disabled={false}
fontSize="medium"
inverted={false}
light={false}
style={
[
{
"color": "#231B22",
"color": "#6B6B78",
"fontFamily": "Rubik",
"fontSize": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 24,
},
{
"color": "#6B6B78",
"lineHeight": 20,
},
]
}
Expand Down Expand Up @@ -191,22 +184,15 @@ exports[`<Dropdown /> Snapshots should match snapshot when disabled 1`] = `
}
>
<Text
bold={false}
disabled={true}
fontSize="medium"
inverted={false}
light={false}
style={
[
{
"color": "#231B22",
"color": "#D7D7E0",
"fontFamily": "Rubik",
"fontSize": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 24,
},
{
"color": "#D7D7E0",
"lineHeight": 20,
},
]
}
Expand Down Expand Up @@ -335,22 +321,15 @@ exports[`<Dropdown /> Snapshots should match snapshot when full 1`] = `
}
>
<Text
bold={false}
disabled={false}
fontSize="medium"
inverted={false}
light={false}
style={
[
{
"color": "#231B22",
"color": "#6B6B78",
"fontFamily": "Rubik",
"fontSize": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 24,
},
{
"color": "#6B6B78",
"lineHeight": 20,
},
]
}
Expand Down Expand Up @@ -486,11 +465,7 @@ exports[`<Dropdown /> Snapshots should match snapshot when has a selected value
}
>
<Text
bold={false}
disabled={true}
fontSize="medium"
inverted={false}
light={false}
selected={
{
"label": "Swimming",
Expand All @@ -503,12 +478,9 @@ exports[`<Dropdown /> Snapshots should match snapshot when has a selected value
{
"color": "#231B22",
"fontFamily": "Rubik",
"fontSize": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 24,
},
{
"color": "#231B22",
"lineHeight": 20,
},
]
}
Expand Down Expand Up @@ -645,11 +617,7 @@ exports[`<Dropdown /> Snapshots should match snapshot with error 1`] = `
}
>
<Text
bold={false}
disabled={false}
fontSize="medium"
inverted={false}
light={false}
selected={
{
"label": "Swimming",
Expand All @@ -662,12 +630,9 @@ exports[`<Dropdown /> Snapshots should match snapshot with error 1`] = `
{
"color": "#231B22",
"fontFamily": "Rubik",
"fontSize": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 24,
},
{
"color": "#231B22",
"lineHeight": 20,
},
]
}
Expand Down
33 changes: 33 additions & 0 deletions packages/yoga/src/Theme/theme/v3theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,38 @@ export const v3theme = createTheme(tokens => ({
},
},
},
dropdown: {
input: {
font: {
size: tokens.fontSizes.small,
lineHeight: tokens.lineHeights.small,
},
},
option: {
font: {
size: tokens.fontSizes.small,
lineHeight: tokens.lineHeights.small,
weight: tokens.fontWeights.medium,
}
},
backdrop: {
content: {
title: {
font: {
weight: tokens.fontWeights.bold,
size: tokens.fontSizes.medium,
},
}
}
},
selected: {
option: {
font: {
weight: tokens.fontWeights.bold,
size: tokens.fontSizes.small,
},
},
},
}
},
}));

0 comments on commit 0b3c3eb

Please sign in to comment.