A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/styleguidist/react-styleguidist/commit/9886b64d254f0c1aaecbf6a2e6a72c01dc329ff8 below:

replace deprecated defaultProps · styleguidist/react-styleguidist@9886b64 · GitHub

File tree Expand file treeCollapse file tree 11 files changed

+160

-211

lines changed

Filter options

Expand file treeCollapse file tree 11 files changed

+160

-211

lines changed Original file line number Diff line number Diff line change

@@ -90,7 +90,7 @@

90 90

"to-ast": "^1.0.0",

91 91

"type-detect": "^4.0.8",

92 92

"unist-util-visit": "^2.0.0",

93 -

"webpack-dev-server": "^4.9.2",

93 +

"webpack-dev-server": "^4.15.0",

94 94

"webpack-merge": "^4.2.2"

95 95

},

96 96

"peerDependencies": {

Original file line number Diff line number Diff line change

@@ -26,7 +26,7 @@ const Examples: React.FunctionComponent<ExamplesRenderer> = ({ examples, name, e

26 26

key={`${codeRevision}/${index}`}

27 27

name={name}

28 28

index={index}

29 -

settings={example.settings}

29 +

settings={example.settings ?? {}}

30 30

exampleMode={exampleMode}

31 31

/>

32 32

);

Original file line number Diff line number Diff line change

@@ -1,5 +1,4 @@

1 1

import React, { cloneElement, Children } from 'react';

2 -

import PropTypes from 'prop-types';

3 2

import cx from 'clsx';

4 3

import Styled, { JssInjectedProps } from 'rsg-components/Styled';

5 4

import * as Rsg from '../../../../typings';

@@ -30,7 +29,7 @@ interface ListProps extends JssInjectedProps {

30 29 31 30

export const ListRenderer: React.FunctionComponent<ListProps> = ({

32 31

classes,

33 -

ordered,

32 +

ordered = false,

34 33

children,

35 34

}) => {

36 35

const Tag = ordered ? 'ol' : 'ul';

@@ -45,13 +44,5 @@ export const ListRenderer: React.FunctionComponent<ListProps> = ({

45 44

</Tag>

46 45

);

47 46

};

48 -

ListRenderer.propTypes = {

49 -

classes: PropTypes.objectOf(PropTypes.string.isRequired).isRequired,

50 -

ordered: PropTypes.bool,

51 -

children: PropTypes.any.isRequired,

52 -

};

53 -

ListRenderer.defaultProps = {

54 -

ordered: false,

55 -

};

56 47 57 48

export default Styled<ListProps>(styles)(ListRenderer);

Original file line number Diff line number Diff line change

@@ -1,5 +1,4 @@

1 1

import React from 'react';

2 -

import PropTypes from 'prop-types';

3 2

import Styled, { JssInjectedProps } from 'rsg-components/Styled';

4 3

import * as Rsg from '../../../../typings';

5 4

@@ -24,23 +23,13 @@ interface TableCellProps extends JssInjectedProps {

24 23 25 24

export const TableCellRenderer: React.FunctionComponent<TableCellProps> = ({

26 25

classes,

27 -

header,

26 +

header = false,

28 27

children,

29 28

}) => {

30 29

if (header) {

31 30

return <th className={classes.th}>{children}</th>;

32 31

}

33 - 34 32

return <td className={classes.td}>{children}</td>;

35 33

};

36 34 37 -

TableCellRenderer.propTypes = {

38 -

classes: PropTypes.objectOf(PropTypes.string.isRequired).isRequired,

39 -

header: PropTypes.bool,

40 -

children: PropTypes.any.isRequired,

41 -

};

42 -

TableCellRenderer.defaultProps = {

43 -

header: false,

44 -

};

45 - 46 35

export default Styled<TableCellProps>(styles)(TableCellRenderer);

Original file line number Diff line number Diff line change

@@ -1,5 +1,4 @@

1 1

import React, { Component } from 'react';

2 -

import PropTypes from 'prop-types';

3 2

import debounce from 'lodash/debounce';

4 3

import Preview from 'rsg-components/Preview';

5 4

import Para from 'rsg-components/Para';

@@ -31,19 +30,6 @@ interface PlaygroundState {

31 30

}

32 31 33 32

class Playground extends Component<PlaygroundProps, PlaygroundState> {

34 -

public static propTypes = {

35 -

code: PropTypes.string.isRequired,

36 -

evalInContext: PropTypes.func.isRequired,

37 -

index: PropTypes.number.isRequired,

38 -

name: PropTypes.string.isRequired,

39 -

exampleMode: PropTypes.string.isRequired,

40 -

settings: PropTypes.object,

41 -

};

42 - 43 -

public static defaultProps = {

44 -

settings: {},

45 -

};

46 - 47 33

public static contextType = Context;

48 34 49 35

private handleChange = debounce((code) => {

Original file line number Diff line number Diff line change

@@ -1,5 +1,4 @@

1 1

import React from 'react';

2 -

import PropTypes from 'prop-types';

3 2

import Styled, { JssInjectedProps } from 'rsg-components/Styled';

4 3

import * as Rsg from '../../../typings';

5 4

@@ -37,7 +36,11 @@ interface RibbonProps extends JssInjectedProps {

37 36

text?: string;

38 37

}

39 38 40 -

export const RibbonRenderer: React.FunctionComponent<RibbonProps> = ({ classes, url, text }) => {

39 +

export const RibbonRenderer: React.FunctionComponent<RibbonProps> = ({

40 +

classes,

41 +

url,

42 +

text = 'Fork me on GitHub',

43 +

}) => {

41 44

return (

42 45

<footer className={classes.root}>

43 46

<a href={url} className={classes.link}>

@@ -47,14 +50,4 @@ export const RibbonRenderer: React.FunctionComponent<RibbonProps> = ({ classes,

47 50

);

48 51

};

49 52 50 -

RibbonRenderer.defaultProps = {

51 -

text: 'Fork me on GitHub',

52 -

};

53 - 54 -

RibbonRenderer.propTypes = {

55 -

classes: PropTypes.objectOf(PropTypes.string.isRequired).isRequired,

56 -

url: PropTypes.string.isRequired,

57 -

text: PropTypes.string,

58 -

};

59 - 60 53

export default Styled<RibbonProps>(styles)(RibbonRenderer);

Original file line number Diff line number Diff line change

@@ -1,5 +1,4 @@

1 1

import React, { Component } from 'react';

2 -

import PropTypes from 'prop-types';

3 2

import TableOfContents from 'rsg-components/TableOfContents';

4 3

import StyleGuideRenderer from 'rsg-components/StyleGuide/StyleGuideRenderer';

5 4

import Sections from 'rsg-components/Sections';

@@ -50,22 +49,6 @@ interface StyleGuideState {

50 49

}

51 50 52 51

export default class StyleGuide extends Component<StyleGuideProps, StyleGuideState> {

53 -

public static propTypes = {

54 -

codeRevision: PropTypes.number.isRequired,

55 -

cssRevision: PropTypes.string.isRequired,

56 -

config: PropTypes.object.isRequired,

57 -

slots: PropTypes.object.isRequired,

58 -

sections: PropTypes.array.isRequired,

59 -

welcomeScreen: PropTypes.bool,

60 -

patterns: PropTypes.array,

61 -

displayMode: PropTypes.string,

62 -

allSections: PropTypes.array.isRequired,

63 -

pagePerSection: PropTypes.bool,

64 -

};

65 -

public static defaultProps = {

66 -

displayMode: DisplayModes.all,

67 -

};

68 - 69 52

public state = {

70 53

error: false,

71 54

info: null,

@@ -85,7 +68,7 @@ export default class StyleGuide extends Component<StyleGuideProps, StyleGuideSta

85 68

sections,

86 69

welcomeScreen,

87 70

patterns,

88 -

displayMode,

71 +

displayMode = DisplayModes.all,

89 72

allSections,

90 73

pagePerSection,

91 74

codeRevision,

Original file line number Diff line number Diff line change

@@ -1,5 +1,4 @@

1 1

import React from 'react';

2 -

import PropTypes from 'prop-types';

3 2

import Styled, { JssInjectedProps } from 'rsg-components/Styled';

4 3

import { Styles } from 'jss';

5 4

import cx from 'clsx';

@@ -55,7 +54,7 @@ export const TabButtonRenderer: React.FunctionComponent<TabButtonProps> = ({

55 54

name,

56 55

className,

57 56

onClick,

58 -

active,

57 +

active = false,

59 58

children,

60 59

}) => {

61 60

const classNames = cx(classes.button, className, {

@@ -75,16 +74,4 @@ export const TabButtonRenderer: React.FunctionComponent<TabButtonProps> = ({

75 74

);

76 75

};

77 76 78 -

TabButtonRenderer.propTypes = {

79 -

classes: PropTypes.objectOf(PropTypes.string.isRequired).isRequired,

80 -

name: PropTypes.string.isRequired,

81 -

className: PropTypes.string,

82 -

onClick: PropTypes.func.isRequired,

83 -

active: PropTypes.bool,

84 -

children: PropTypes.any.isRequired,

85 -

};

86 -

TabButtonRenderer.defaultProps = {

87 -

active: false,

88 -

};

89 - 90 77

export default Styled<TabButtonProps>(styles)(TabButtonRenderer);

Original file line number Diff line number Diff line change

@@ -1,5 +1,4 @@

1 1

import React, { Component } from 'react';

2 -

import PropTypes from 'prop-types';

3 2

import ComponentsList from 'rsg-components/ComponentsList';

4 3

import TableOfContentsRenderer from 'rsg-components/TableOfContents/TableOfContentsRenderer';

5 4

import filterSectionsByName from '../../utils/filterSectionsByName';

@@ -10,21 +9,10 @@ interface TableOfContentsProps {

10 9

sections: Rsg.Section[];

11 10

useRouterLinks?: boolean;

12 11

tocMode?: string;

13 -

loc: { hash: string; pathname: string };

12 +

loc?: { hash: string; pathname: string };

14 13

}

15 14 16 15

export default class TableOfContents extends Component<TableOfContentsProps> {

17 -

public static propTypes = {

18 -

sections: PropTypes.array.isRequired,

19 -

useRouterLinks: PropTypes.bool,

20 -

tocMode: PropTypes.string,

21 -

loc: PropTypes.object,

22 -

};

23 - 24 -

public static defaultProps = {

25 -

loc: window.location,

26 -

};

27 - 28 16

public state = {

29 17

searchTerm: '',

30 18

};

@@ -36,7 +24,7 @@ export default class TableOfContents extends Component<TableOfContentsProps> {

36 24

useHashId = false

37 25

): { content: React.ReactElement; containsSelected: boolean } {

38 26

// Match selected component in both basic routing and pagePerSection routing.

39 -

const { hash, pathname } = this.props.loc;

27 +

const { hash, pathname } = this.props.loc ?? window.location;

40 28

const windowHash = pathname + (useRouterLinks ? hash : getHash(hash));

41 29 42 30

let childrenContainSelected = false;

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4