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
function filterAnimals(animals) { | |
if (!FeatureFlag.releaseTheLions) { | |
return animals.filter(maybeLeo => maybeLeo.id !== 'lion'); | |
} | |
} | |
const AnimalsList: React.VFC = () => { | |
const animals = [ | |
{ | |
name: 'Leo', |
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
/** | |
* Component Test | |
*/ | |
describe('CharacterCreateForm', () => { | |
it('should not submit form and show error message if name is null', async () => { | |
const onSubmitMock = jest.fn() | |
const { getByTestId, queryByTestId } = render( | |
<CharacterCreateForm onSubmit={onSubmitMock} /> | |
) | |
const submitButton = getByTestId('form-submit-button') |
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
import React from 'react'; | |
import { Character } from '../../api/types'; | |
import { | |
Wrapper, | |
List, | |
ListItem, | |
ListItemInfo, | |
NameWrapper, | |
IsJediWrapper, | |
HeaderTypography |
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
import React from 'react'; | |
import { useSelector, useDispatch } from 'react-redux'; | |
import { CharacterList } from '../../components/CharacterList' | |
import { ActionList } from '../../components/ActionList'; | |
import { characterListLoadingSelector, characterListSelector } from '../../redux/selectors'; | |
import { actions } from '../../redux/actions'; | |
interface CharacterListContainerProps { | |
createCharacterPath: string | |
} |
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
import React from 'react'; | |
import { Route } from 'react-router-dom'; | |
import { Page } from '../../components/Page'; | |
import { CharacterListContainer } from '../../containers/CharacterList'; | |
import { CHARACTERS_CREATE } from '../../routes'; | |
import { CharactersCreateView } from '../CharactersCreate'; | |
export const CharactersView: React.FunctionComponent = () => { | |
return ( | |
<Page> |
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
<Switch> | |
<Route path="/users" exact component={UsersView} /> | |
<Route path="/home" exact component={HomeView} /> | |
<Route path="/settings" exact component={SettingsView} /> | |
</Switch> | |
<Switch> | |
<Route path="/users" component={UsersList} /> | |
<Route path="/users/create" exact component={CreateUserView} /> | |
<Route path="/users/:id" exact component={EditUserView} /> |
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
import invariant from 'invariant' | |
import { matchPath } from 'react-router' | |
import { pathToRegexp, compile } from 'path-to-regexp' | |
import map from 'lodash/map' | |
import trim from 'lodash/trim' | |
import flow from 'lodash/flow' | |
import partialRight from 'lodash/partialRight' | |
import isString from 'lodash/isString' | |
import isEmpty from 'lodash/isEmpty' | |
import { createSymbol } from '../../utils' |
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
{"lastUpload":"2020-01-27T12:30:45.167Z","extensionVersion":"v3.4.3"} |
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
const TitleSubtitleCell => ({ title, subtitle }) => ( | |
<div> | |
<Title>{title}</Title> | |
<SubTitle>{subtitle}</SubTitle> | |
</div> | |
) | |
const columns = [{ | |
header: | |
width: 'grow', // A width props supports custom column sizing |
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
import React from 'react' | |
import useIsElementInView from './useIsElementInView' | |
export function Example() { | |
const { ref, isInView } = useIsElementInView() | |
return ( | |
<div ref={ref}> | |
{isInView ? 'It is in the view!' : 'Not in view (so you cant really even tell if it works I guess...)'} | |
</div> |
NewerOlder