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

PHC-4075 - Add base style [OAuthLoginButton] #64

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

namick
Copy link
Contributor

@namick namick commented Mar 3, 2023

Changes

  • Add base wireframe color scheme
  • Style the OAuthLoginButton
  • Add the DemoApp as a Storybook story

Screenshots

Screen.Recording.2023-03-03.at.10.19.02.AM.mov

@namick namick marked this pull request as draft March 3, 2023 12:47
@coveralls
Copy link

coveralls commented Mar 3, 2023

Pull Request Test Coverage Report for Build 4324981218

  • 11 of 16 (68.75%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 95.854%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/screens/LoginScreen.tsx 0 5 0.0%
Files with Coverage Reduction New Missed Lines %
src/screens/LoginScreen.tsx 1 0%
Totals Coverage Status
Change from base Build 4318210254: -0.4%
Covered Lines: 474
Relevant Lines: 495

💛 - Coveralls

@namick namick force-pushed the PHC-4075-add-basic-wireframe-styling branch from 1a62b3a to 5d38319 Compare March 3, 2023 15:12
Comment on lines +1 to +10
import React from 'react';
import { storiesOf } from '@storybook/react-native';
import { authConfig } from './OAuth.stories';
import { RootProviders, RootStack } from 'src';

storiesOf('Example App', module).add('DemoApp', () => (
<RootProviders authConfig={authConfig}>
<RootStack />
</RootProviders>
));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add the whole demo app as a storybook story.

Copy link
Contributor

@markdlv markdlv Mar 3, 2023

Choose a reason for hiding this comment

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

Nice! I had run into some SafeArea issues before where I thought the one storybook was providing & the <SafeAreaProvider> in RootProviders were fighting. Looking back, I'm betting I was instead just hitting npm / metro / path issues between example & root, and confusing the two. This will be super helpful

Comment on lines 1 to 39
/**
* Base (wireFrame-like) color scheme
*
* The base color scheme uses a popular design system to
* dynamically generate all color tokens from the HTML color:
* "gray" - #808080 - rgb(128,128,128)
*/
const scheme = {
light: {
primary: 'rgb(0, 104, 116)',
onPrimary: 'rgb(255, 255, 255)',
primaryContainer: 'rgb(151, 240, 255)',
onPrimaryContainer: 'rgb(0, 31, 36)',

secondary: 'rgb(74, 98, 103)',
onSecondary: 'rgb(255, 255, 255)',
secondaryContainer: 'rgb(205, 231, 236)',
onSecondaryContainer: 'rgb(5, 31, 35)',

tertiary: 'rgb(82, 94, 125)',
onTertiary: 'rgb(255, 255, 255)',
tertiaryContainer: 'rgb(218, 226, 255)',
onTertiaryContainer: 'rgb(14, 27, 55)',

error: 'rgb(186, 26, 26)',
onError: 'rgb(255, 255, 255)',
errorContainer: 'rgb(255, 218, 214)',
onErrorContainer: 'rgb(65, 0, 2)',

background: 'rgb(250, 253, 253)',
onBackground: 'rgb(25, 28, 29)',

surface: 'rgb(250, 253, 253)',
onSurface: 'rgb(25, 28, 29)',
surfaceVariant: 'rgb(219, 228, 230)',
onSurfaceVariant: 'rgb(63, 72, 74)',

outline: 'rgb(111, 121, 122)',
outlineVariant: 'rgb(191, 200, 202)',
Copy link
Contributor Author

@namick namick Mar 3, 2023

Choose a reason for hiding this comment

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

Screenshot 2023-03-03 at 10 43 53 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should be able to refer to these colors visually by clicking back to this PR from a vscode context menu near this code.

Comment on lines +72 to +87
const label: TextStyle = {
color: theme.colors.onPrimary,
marginVertical: 10,
marginHorizontal: 24,

fontFamily: Platform.select({
web: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
ios: 'System',
default: 'sans-serif-medium',
}),

fontWeight: '500',
letterSpacing: 0.1,
lineHeight: 20,
fontSize: 14,
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lots of this will be boilerplate for many components and should be moved to the theme. A good example of how this can be done is found here:

https://github.com/callstack/react-native-paper/blob/main/src/styles/themes/v3/tokens.tsx

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Great offline discussion on RN paper too. I'm all for considering adopting that to avoid having to write too much code for things like Button, Text, icons, what props should a theme have, etc. Maybe their providers could be wrapped by ours if/where needed. Let's maybe shoot for a 1 day prototype on this next week

@namick namick changed the title PHC-4075 - Add base wireframe color scheme PHC-4075 - Add base style [OAuthLoginButton] Mar 3, 2023
@namick namick marked this pull request as ready for review March 3, 2023 15:32
@namick namick requested a review from sternetj March 3, 2023 15:33
@namick namick force-pushed the PHC-4075-add-basic-wireframe-styling branch from 5d38319 to 6fd59da Compare March 3, 2023 15:41
Copy link
Contributor

@markdlv markdlv left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for making this incremental

return { button, touchableOpacity, content, label };
};

declare module './BrandConfigProvider/types' {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we could use TypeScript paths here to make this a bit easier. i.e. declare module '@style' {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I spent some time trying to figure this out, but it sound like you already know the way! Awesome, will update in next PR

fontSize: 14,
};

return { button, touchableOpacity, content, label };
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of declaring variables for each named style we could do something like:

return {
  button: {
    // ...
  } as ViewStyle,
  label: {
    // ...
  } as TextStyle,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By casting, wouldn't we lose the type checking in the object itself? My understanding was to not prefer casting. For instance, this compiles just fine:

content = {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'center',
    notValid: 'garbage',
  } as ViewStyle;

Copy link
Contributor

Choose a reason for hiding this comment

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

Great point! We shouldn't do that then.

@namick namick merged commit e7871f5 into master Mar 3, 2023
@namick namick deleted the PHC-4075-add-basic-wireframe-styling branch March 3, 2023 17:38
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

🎉 This PR is included in version 1.1.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Has been released to the package repository (NPM, etc) label Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Has been released to the package repository (NPM, etc)
Projects
None yet
4 participants