Skip to content
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
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default [
'observation/no-function-without-logging': [
'error',
{
ignoreList: ['createStyles'],
ignoreList: ['createStyles', 'createTextStyles'],
},
],

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observation.org/react-native-components",
"version": "1.96.0",
"version": "1.97.0",
"main": "src/index.ts",
"exports": {
".": "./src/index.ts",
Expand Down
5 changes: 1 addition & 4 deletions src/components/InputPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ const createStyles = (theme: Theme) => {
paddingHorizontal: theme.margin.common,
},
headerTextStyle: {
...theme.font.extraSmall,
lineHeight: theme.font.extraSmall.fontSize,
letterSpacing: 0.03 * theme.font.extraSmall.fontSize,
color: theme.color.text.system.subtler,
...theme.text.inputPanelHeader,
},
contentContainer: {
flex: 1,
Expand Down
24 changes: 12 additions & 12 deletions src/components/__tests__/__snapshots__/InputPanel.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports[`InputPanel Rendering Capitalize value 1`] = `
"flexDirection": "column",
},
{
"paddingVertical": 9,
"paddingVertical": 8,
},
]
}
Expand All @@ -63,7 +63,7 @@ exports[`InputPanel Rendering Capitalize value 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
"letterSpacing": 0.3,
"lineHeight": 10,
"lineHeight": 12,
}
}
>
Expand Down Expand Up @@ -153,7 +153,7 @@ exports[`InputPanel Rendering Disabled 1`] = `
"flexDirection": "column",
},
{
"paddingVertical": 9,
"paddingVertical": 8,
},
]
}
Expand All @@ -169,7 +169,7 @@ exports[`InputPanel Rendering Disabled 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
"letterSpacing": 0.3,
"lineHeight": 10,
"lineHeight": 12,
}
}
>
Expand Down Expand Up @@ -348,7 +348,7 @@ exports[`InputPanel Rendering No value 1`] = `
"flexDirection": "column",
},
{
"paddingVertical": 9,
"paddingVertical": 8,
},
]
}
Expand All @@ -364,7 +364,7 @@ exports[`InputPanel Rendering No value 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
"letterSpacing": 0.3,
"lineHeight": 10,
"lineHeight": 12,
}
}
>
Expand Down Expand Up @@ -454,7 +454,7 @@ exports[`InputPanel Rendering With content 1`] = `
"flexDirection": "column",
},
{
"paddingVertical": 9,
"paddingVertical": 8,
},
]
}
Expand All @@ -470,7 +470,7 @@ exports[`InputPanel Rendering With content 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
"letterSpacing": 0.3,
"lineHeight": 10,
"lineHeight": 12,
}
}
>
Expand Down Expand Up @@ -560,7 +560,7 @@ exports[`InputPanel Rendering With value style 1`] = `
"flexDirection": "column",
},
{
"paddingVertical": 9,
"paddingVertical": 8,
},
]
}
Expand All @@ -576,7 +576,7 @@ exports[`InputPanel Rendering With value style 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
"letterSpacing": 0.3,
"lineHeight": 10,
"lineHeight": 12,
}
}
>
Expand Down Expand Up @@ -668,7 +668,7 @@ exports[`InputPanel Rendering Without chevron 1`] = `
"flexDirection": "column",
},
{
"paddingVertical": 9,
"paddingVertical": 8,
},
]
}
Expand All @@ -684,7 +684,7 @@ exports[`InputPanel Rendering Without chevron 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
"letterSpacing": 0.3,
"lineHeight": 10,
"lineHeight": 12,
}
}
>
Expand Down
36 changes: 26 additions & 10 deletions src/theme/tokens/text.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { Text, Theme } from '../types'

export const createTextStyles = (theme: Theme) =>
({
export const createTextStyles = (theme: Theme) => {
const speciesLocalName = {
fontFamily: 'Ubuntu',
fontStyle: 'normal',
fontSize: 16,
lineHeight: 24,
fontWeight: 'bold',
color: theme.color.text.system.strong,
} satisfies Text['speciesLocalName']

return {
iconLabel: {
...theme.font.extraSmall,
color: theme.color.text.system.subtle,
Expand All @@ -19,13 +28,10 @@ export const createTextStyles = (theme: Theme) =>
fontStyle: 'italic',
color: theme.color.text.system.subtler,
},
speciesLocalName: {
fontFamily: 'Ubuntu',
fontStyle: 'normal',
fontSize: 16,
lineHeight: 24,
fontWeight: 'bold',
color: theme.color.text.system.strong,
speciesLocalName,
speciesLocalNameCompact: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Als je binnen de factory method dit definieert:

  const speciesLocalName = {
    fontFamily: 'Ubuntu',
    fontStyle: 'normal',
    fontSize: 16,
    lineHeight: 24,
    fontWeight: 'bold',
    color: theme.color.text.system.strong,
  } satisfies Text['speciesLocalName']

dan kun je hier dit doen:

    speciesLocalName,
    speciesLocalNameCompact: {
      ...speciesLocalName,
      lineHeight: 22,
    },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 aangepast

...speciesLocalName,
lineHeight: 22,
},
speciesScientificName: {
fontFamily: 'Ubuntu',
Expand Down Expand Up @@ -85,4 +91,14 @@ export const createTextStyles = (theme: Theme) =>
...theme.font.extraSmall,
color: theme.color.text.system.subtler,
},
}) satisfies Text
inputPanelHeader: {
fontFamily: 'Ubuntu',
fontStyle: 'normal',
fontSize: 10,
lineHeight: 12,
fontWeight: 'normal',
letterSpacing: 0.3,
color: theme.color.text.system.subtler,
},
} satisfies Text
}
4 changes: 4 additions & 0 deletions src/theme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ export type TextName =
| 'thumbnail'
| 'subLabel'
| 'speciesLocalName'
| 'speciesLocalNameCompact'
| 'speciesScientificName'
| 'inputPanelHeader'
| keyof TextNameOverrides

export interface Text {
Expand All @@ -323,6 +325,8 @@ export interface Text {
thumbnail: TextStyle
subLabel: TextStyle
speciesLocalName: TextStyle
speciesLocalNameCompact: TextStyle
speciesScientificName: TextStyle
inputPanelHeader: TextStyle
[name: string]: TextStyle
}