Skip to content

Commit

Permalink
Merge pull request #301 from lad-tech/292-mobydick-20-fonts-controls
Browse files Browse the repository at this point in the history
292 mobydick 20 fonts controls and chat
  • Loading branch information
vpsmolina authored Jan 17, 2025
2 parents 845795a + c9ff332 commit d754ba2
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 42 deletions.
15 changes: 7 additions & 8 deletions packages/core/src/chat/components/ChatMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Image} from 'react-native';

import View from '../../basic/components/View/View';
import {TypographyLegacy} from '../../typography';
import {Typography} from '../../typography';
import {isNumber} from '../../other/functions/isNumber';
import useStyles from '../../styles/hooks/useStyles';
import {isValidMessageTime} from '../functions/isValidMessageTime';
Expand All @@ -27,19 +27,18 @@ const ChatMessage = (props: IChatMessage) => {

{message && (
<View style={styles.textArea}>
<TypographyLegacy
font={isMe ? 'Regular-White-XS' : 'Regular-Secondary-XS'}>
<Typography font={isMe ? 'Regular-White-S' : 'Regular-Secondary-S'}>
{message}
</TypographyLegacy>
</Typography>
</View>
)}

<View style={styles.timeArea}>
{isValidMessageTime(time) && (
<TypographyLegacy
font={isMe ? 'Regular-WhiteExtra-XXXS' : 'Regular-Muted-XXXS'}>
<Typography
font={isMe ? 'Regular-WhiteExtra-XXS' : 'Regular-Muted-XXS'}>
{time}
</TypographyLegacy>
</Typography>
)}
</View>
</View>
Expand All @@ -54,7 +53,7 @@ const stylesCreate = createStyles(({spaces, colors}, isMe: boolean) => ({
maxWidth: '90%',
},
bubble: {
backgroundColor: isMe ? colors.ElementBase : colors.BgPrimary,
backgroundColor: isMe ? colors.ElementAccent : colors.BgPrimary,
borderRadius: spaces.Space10,
borderBottomLeftRadius: isMe ? spaces.Space10 : 0,
borderBottomRightRadius: isMe ? 0 : spaces.Space10,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/chat/components/ChatPressableIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ChatPressableIcon = (props: IChatPressableIcon) => {
const {colors} = useTheme();
const {
name,
color = colors.IconBase,
color = colors.IconAccent,
backgroundColor = colors.BgAccent,
...otherProps
} = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ exports[`@lad-tech/mobydick-core/ChatMessage renders correctly isNotValid time
{
"color": "#353A45",
"fontFamily": "Inter-Regular",
"fontSize": 12,
"lineHeight": 16,
"minHeight": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 18,
"minHeight": 18,
},
undefined,
]
Expand Down Expand Up @@ -98,9 +99,10 @@ exports[`@lad-tech/mobydick-core/ChatMessage renders correctly isMe 1`] = `
{
"color": "#FFFFFF",
"fontFamily": "Inter-Regular",
"fontSize": 12,
"lineHeight": 16,
"minHeight": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 18,
"minHeight": 18,
},
undefined,
]
Expand All @@ -126,6 +128,7 @@ exports[`@lad-tech/mobydick-core/ChatMessage renders correctly isMe 1`] = `
"color": "rgba(255, 255, 255, 0.8)",
"fontFamily": "Inter-Regular",
"fontSize": 10,
"fontWeight": "400",
"lineHeight": 14,
"minHeight": 14,
},
Expand Down Expand Up @@ -209,6 +212,7 @@ exports[`@lad-tech/mobydick-core/ChatMessage renders correctly isMe image 1`] =
"color": "rgba(255, 255, 255, 0.8)",
"fontFamily": "Inter-Regular",
"fontSize": 10,
"fontWeight": "400",
"lineHeight": 14,
"minHeight": 14,
},
Expand Down Expand Up @@ -288,6 +292,7 @@ exports[`@lad-tech/mobydick-core/ChatMessage renders correctly isMe image number
"color": "rgba(255, 255, 255, 0.8)",
"fontFamily": "Inter-Regular",
"fontSize": 10,
"fontWeight": "400",
"lineHeight": 14,
"minHeight": 14,
},
Expand Down Expand Up @@ -339,9 +344,10 @@ exports[`@lad-tech/mobydick-core/ChatMessage renders correctly isNotMe 1`] = `
{
"color": "#353A45",
"fontFamily": "Inter-Regular",
"fontSize": 12,
"lineHeight": 16,
"minHeight": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 18,
"minHeight": 18,
},
undefined,
]
Expand All @@ -367,6 +373,7 @@ exports[`@lad-tech/mobydick-core/ChatMessage renders correctly isNotMe 1`] = `
"color": "#9BA1B0",
"fontFamily": "Inter-Regular",
"fontSize": 10,
"fontWeight": "400",
"lineHeight": 14,
"minHeight": 14,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ exports[`@lad-tech/mobydick-core/ChatMessageAvatar renders correctly isNotMe 1`]
{
"color": "#353A45",
"fontFamily": "Inter-Regular",
"fontSize": 12,
"lineHeight": 16,
"minHeight": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 18,
"minHeight": 18,
},
undefined,
]
Expand All @@ -150,6 +151,7 @@ exports[`@lad-tech/mobydick-core/ChatMessageAvatar renders correctly isNotMe 1`]
"color": "#9BA1B0",
"fontFamily": "Inter-Regular",
"fontSize": 10,
"fontWeight": "400",
"lineHeight": 14,
"minHeight": 14,
},
Expand Down Expand Up @@ -287,9 +289,10 @@ exports[`@lad-tech/mobydick-core/ChatMessageAvatar renders correctly onPress 1`]
{
"color": "#FFFFFF",
"fontFamily": "Inter-Regular",
"fontSize": 12,
"lineHeight": 16,
"minHeight": 16,
"fontSize": 14,
"fontWeight": "400",
"lineHeight": 18,
"minHeight": 18,
},
undefined,
]
Expand All @@ -315,6 +318,7 @@ exports[`@lad-tech/mobydick-core/ChatMessageAvatar renders correctly onPress 1`]
"color": "rgba(255, 255, 255, 0.8)",
"fontFamily": "Inter-Regular",
"fontSize": 10,
"fontWeight": "400",
"lineHeight": 14,
"minHeight": 14,
},
Expand Down
26 changes: 13 additions & 13 deletions packages/core/src/controls/ControlsLists/__tests__/ControlsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import {render} from '@testing-library/react-native';
import {ControlsList} from '../index';
import {CheckBox} from '../../CheckBox';
import {Radio} from '../../Radio';
import {TypographyLegacy} from '../../../typography/components/TypographyLegacy/TypographyLegacy';
import {Typography} from '../../../typography';

describe('ControlsList', () => {
it('should renders correctly with checkbox type', function () {
const {toJSON} = render(
<ControlsList single={false} onChange={jest.fn} values={[]}>
<CheckBox value={'1'}>
<TypographyLegacy font={'Regular-Primary-M'}>1</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>1</Typography>
</CheckBox>
<CheckBox value={'2'}>
<TypographyLegacy font={'Regular-Primary-M'}>2</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>2</Typography>
</CheckBox>
</ControlsList>,
);
Expand All @@ -24,10 +24,10 @@ describe('ControlsList', () => {
const {toJSON} = render(
<ControlsList single onChange={jest.fn} values={[]}>
<CheckBox value={'1'}>
<TypographyLegacy font={'Regular-Primary-M'}>1</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>1</Typography>
</CheckBox>
<CheckBox value={'2'}>
<TypographyLegacy font={'Regular-Primary-M'}>2</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>2</Typography>
</CheckBox>
</ControlsList>,
);
Expand All @@ -38,10 +38,10 @@ describe('ControlsList', () => {
const {toJSON} = render(
<ControlsList single onChange={jest.fn} horizontal values={[]}>
<CheckBox value={'1'}>
<TypographyLegacy font={'Regular-Primary-M'}>1</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>1</Typography>
</CheckBox>
<CheckBox value={'2'}>
<TypographyLegacy font={'Regular-Primary-M'}>2</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>2</Typography>
</CheckBox>
</ControlsList>,
);
Expand All @@ -52,10 +52,10 @@ describe('ControlsList', () => {
const {toJSON} = render(
<ControlsList single onChange={jest.fn} values={['1']}>
<Radio value={'1'}>
<TypographyLegacy font={'Regular-Primary-M'}>1</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>1</Typography>
</Radio>
<Radio value={'2'}>
<TypographyLegacy font={'Regular-Primary-M'}>2</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>2</Typography>
</Radio>
</ControlsList>,
);
Expand All @@ -66,10 +66,10 @@ describe('ControlsList', () => {
const {toJSON} = render(
<ControlsList single onChange={jest.fn} values={[]}>
<Radio value={'1'}>
<TypographyLegacy font={'Regular-Primary-M'}>1</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>1</Typography>
</Radio>
<Radio value={'2'}>
<TypographyLegacy font={'Regular-Primary-M'}>2</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>2</Typography>
</Radio>
</ControlsList>,
);
Expand All @@ -80,10 +80,10 @@ describe('ControlsList', () => {
const {toJSON} = render(
<ControlsList onChange={jest.fn} horizontal values={[]}>
<Radio value={'1'}>
<TypographyLegacy font={'Regular-Primary-M'}>1</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>1</Typography>
</Radio>
<Radio value={'2'}>
<TypographyLegacy font={'Regular-Primary-M'}>2</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>2</Typography>
</Radio>
</ControlsList>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ exports[`ControlsList should renders correctly with checkbox type 1`] = `
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -211,6 +212,7 @@ exports[`ControlsList should renders correctly with checkbox type 1`] = `
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -330,6 +332,7 @@ exports[`ControlsList should renders correctly with checkbox type and horizontal
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -435,6 +438,7 @@ exports[`ControlsList should renders correctly with checkbox type and horizontal
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -554,6 +558,7 @@ exports[`ControlsList should renders correctly with checkbox type and single 1`]
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -659,6 +664,7 @@ exports[`ControlsList should renders correctly with checkbox type and single 1`]
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -790,6 +796,7 @@ exports[`ControlsList should renders correctly with radio type 1`] = `
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -895,6 +902,7 @@ exports[`ControlsList should renders correctly with radio type 1`] = `
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -1014,6 +1022,7 @@ exports[`ControlsList should renders correctly with radio type and horizontal 1`
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -1119,6 +1128,7 @@ exports[`ControlsList should renders correctly with radio type and horizontal 1`
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -1238,6 +1248,7 @@ exports[`ControlsList should renders correctly with radio type and single 1`] =
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down Expand Up @@ -1343,6 +1354,7 @@ exports[`ControlsList should renders correctly with radio type and single 1`] =
"color": "#20242D",
"fontFamily": "Inter-Regular",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 20,
"minHeight": 20,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import {ReactTestInstance} from 'react-test-renderer';
import {Radio} from '../../Radio';
import useCloneControls from '../useCloneControls';
import {ControlsList} from '../index';
import {TypographyLegacy} from '../../../typography/components/TypographyLegacy/TypographyLegacy';
import {Typography} from '../../../typography';

const list = (single: boolean) => (
<ControlsList single={single} onChange={jest.fn} values={[]}>
<Radio value={'1'}>
<TypographyLegacy font={'Regular-Primary-M'}>1</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>1</Typography>
</Radio>
<Radio value={'2'}>
<TypographyLegacy font={'Regular-Primary-M'}>2</TypographyLegacy>
<Typography font={'Regular-Primary-M'}>2</Typography>
</Radio>
</ControlsList>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/controls/Radio/stylesCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const stylesCreate = createStyles(
width: px(22),
aspectRatio: 1,
borderRadius: px(11),
backgroundColor: selected ? colors.ElementBase : 'transparent',
borderColor: selected ? colors.ElementBase : colors.BorderNormal,
backgroundColor: selected ? colors.ElementAccent : 'transparent',
borderColor: selected ? colors.ElementAccent : colors.BorderNormal,
borderWidth: spaces.Space2,
justifyContent: 'center',
alignItems: 'center',
Expand Down

0 comments on commit d754ba2

Please sign in to comment.