-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: handle pages and base navigation differently * feat: rename shared components with ui * feat: update the page generator * chore: remove other generators for now
- Loading branch information
Showing
62 changed files
with
91 additions
and
231 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
--- | ||
to: src/components/<%= h.changeCase.pascalCase(componentName) %>/components/<%= h.changeCase.pascalCase(componentName) %>.tsx | ||
to: src/pages/<%= h.changeCase.pascalCase(componentName) %>.tsx | ||
--- | ||
import { Component } from 'react'; | ||
import { Box, Text } from '$components/ui/primitives'; | ||
import SafeView from '$components/ui/SafeView'; | ||
import { <%= h.changeCase.pascalCase(componentName) %>ScreenNavigationProp } from '$navigation/navigation.types'; | ||
|
||
import { Flex, Title } from '$shared/primitives'; | ||
import SafeView from '$shared/SafeView'; | ||
|
||
type Props = { | ||
someProps?: string; | ||
}; | ||
|
||
const initialState = { | ||
someState: 'Some state', | ||
type <%= h.changeCase.pascalCase(componentName) %>Props = { | ||
navigation: <%= h.changeCase.pascalCase(componentName) %>ScreenNavigationProp; | ||
}; | ||
|
||
type State = typeof initialState; | ||
|
||
class <%= h.changeCase.pascalCase(componentName) %> extends Component<Props, State> { | ||
state = initialState; | ||
|
||
render() { | ||
return ( | ||
<SafeView> | ||
<Flex justifyContent="center" alignItems="center"> | ||
<Title><%= h.changeCase.pascalCase(componentName) %> page</Title> | ||
</Flex> | ||
</SafeView> | ||
); | ||
} | ||
} | ||
const <%= h.changeCase.pascalCase(componentName) %> = ({ navigation }: <%= h.changeCase.pascalCase(componentName) %>Props) => ( | ||
<SafeView edges={['bottom']}> | ||
<Box flex={1}> | ||
<Text variant="large"><%= h.changeCase.pascalCase(componentName) %> page</Text> | ||
</Box> | ||
</SafeView> | ||
); | ||
|
||
export default <%= h.changeCase.pascalCase(componentName) %>; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
--- | ||
to: src/components/<%= h.changeCase.pascalCase(componentName) %>/components/__tests__/<%= h.changeCase.pascalCase(componentName) %>.test.tsx | ||
to: src/pages/__tests__/<%= h.changeCase.pascalCase(componentName) %>.test.tsx | ||
--- | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
// import { fireEvent } from '@testing-library/react-native'; | ||
|
||
import render from '$tests/utils'; | ||
import { render } from '$tests/utils'; | ||
|
||
import <%= h.changeCase.pascalCase(componentName) %> from '../<%= h.changeCase.pascalCase(componentName) %>'; | ||
|
||
describe('<%= h.changeCase.pascalCase(componentName) %> page component', () => { | ||
// given | ||
describe('<%= h.changeCase.pascalCase(componentName) %> page', () => { | ||
// Given | ||
const props = { navigation: { navigate: jest.fn() } as any }; | ||
|
||
it('should render correctly', () => { | ||
// When | ||
const wrapper = render(<<%= h.changeCase.pascalCase(componentName) %> />); | ||
// Given | ||
const { getByText } = render(<<%= h.changeCase.pascalCase(componentName) %> {...props} />); | ||
|
||
// Then | ||
expect(wrapper).toMatchSnapshot(); | ||
expect(getByText('<%= h.changeCase.pascalCase(componentName) %> page')).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
inject: true | ||
before: inject screens before this | ||
to: src/navigation/navigation.tsx | ||
--- | ||
<Stack.Screen | ||
name="<%= h.changeCase.pascalCase(componentName) %>" | ||
component={Pages.<%= h.changeCase.pascalCase(componentName) %>} | ||
/> |
2 changes: 1 addition & 1 deletion
2
...ors/page/routesTypesScreenInjection.ejs.t → ...page/navigationTypesScreenInjection.ejs.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
_templates/generators/page/navigationTypesStackInjection.ejs.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
inject: true | ||
before: // inject stack types before this | ||
to: src/navigation/navigation.types.ts | ||
--- | ||
<%= h.changeCase.pascalCase(componentName) %>: undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
inject: true | ||
before: // inject exports before this | ||
to: src/routes/pages.ts | ||
to: src/navigation/pages.ts | ||
--- | ||
<%= h.changeCase.pascalCase(componentName) %>, | ||
<%= h.changeCase.pascalCase(componentName) %>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
inject: true | ||
before: inject pages before this | ||
to: src/routes/pages.ts | ||
to: src/navigation/pages.ts | ||
--- | ||
const <%= h.changeCase.pascalCase(componentName) %> = lazy(() => import('components/<%= h.changeCase.pascalCase(componentName) %>')); | ||
import <%= h.changeCase.pascalCase(componentName) %> from '$pages/<%= h.changeCase.pascalCase(componentName) %>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
module.exports = [ | ||
{ | ||
type: 'input', | ||
name: 'name', | ||
message: "What's the route name ?", | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'componentName', | ||
message: "What's the component name ?", | ||
message: "What's the component name?", | ||
}, | ||
]; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/home/components/Header.tsx → src/components/home/Header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mponents/home/components/Informations.tsx → src/components/home/Informations.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default } from './components/Home'; | ||
export { default as Header } from './Header'; | ||
export { default as Informations } from './Informations'; |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/components/shared/FallbackLoader.tsx → src/components/ui/FallbackLoader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.