-
Notifications
You must be signed in to change notification settings - Fork 114
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
Polish component docs #153
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
42fb2a1
feat: Add a PageTitle component and update the reference templates to…
jerelmiller f7cc7ca
chore: Update line-height site-wide
jerelmiller fb68322
chore: Update spacing and font-weight on page title
jerelmiller 2ae65d8
chore: Remove spacing on description
jerelmiller e6dd2bf
chore: Remove top margin from all headers
jerelmiller 742cce1
feat: More tweaks to component doc styling
jerelmiller 52e0c85
feat: Polish styles on method references
jerelmiller c5cc80f
feat: Add some polish to the prop list
jerelmiller 567e1d5
refactor: Extract getTypeDefs into util function
jerelmiller 8e5dd80
chore: Polish styles on type def reference
jerelmiller 6c5f51a
chore: better spacing for all p tags
jerelmiller cc6c84f
feat: Create a CodeDef component to abstract the styles of a code def…
jerelmiller d8e80b3
chore: Use CodeDef in TypeDefReference
jerelmiller 630ff4f
feat: Add operator component for code def
jerelmiller 2f86c62
chore: Better line height and color for keywords
jerelmiller 720e4c1
chore: Update FunctionDefinition to use CodeDef
jerelmiller 361a71f
feat: Update ConstantReference to use CodeDef
jerelmiller b0ecdfc
feat: Add number and string components for code def
jerelmiller b15f120
feat: Add syntax highlighting for constants
jerelmiller 83d33f8
refactor: Extract value to JsonValue component
jerelmiller ce0eb31
chore: Swap margins on p tags
jerelmiller 3d021b1
Merge remote-tracking branch 'origin/master' into jerel/polish-compon…
jerelmiller 23190b0
feat: Create a Markdown component
jerelmiller 41b654c
feat: Change default list styles
jerelmiller 7193215
feat: Use Markdown component for reference templates
jerelmiller d957f4d
feat: Use the Markdown component for MethodReference
jerelmiller 6a72ead
chore: Minor tweaks to code inside markdown
jerelmiller 3e36937
feat: Remove bottom margin in markdown if p tag is last
jerelmiller db01bd6
feat: Add small spacing and border radius on types
jerelmiller a5591d4
feat: Polish some more styles on prop list
jerelmiller b120fdc
chore: Remove border between examples
jerelmiller 555cddc
chore: Omit Select from live examples
jerelmiller 0aa2bb0
feat: Add a max height on component examples
jerelmiller 6e94f13
feat: Smarter line break opportunities for default values
jerelmiller de6e2df
fix: Ensure right-column on prop list does not overflow
jerelmiller b0cf375
chore: Switch to overflow-wrap
jerelmiller 7020f7a
feat: Polish icon gallery
jerelmiller c4e6094
feat: Ensure charts examples have a height defined
jerelmiller 96650aa
feat: Double the space on shape prop types
jerelmiller 305946d
feat: Ensure equal spacing between prop list info
jerelmiller a9bea8d
chore: Update renamed bracket component
jerelmiller 5d4eab3
refactor: Simpler logic for wrapping function def keyword/bracket
jerelmiller ebc3073
chore: Place word-break opportunity before .
jerelmiller 867b60c
Merge remote-tracking branch 'origin/master' into jerel/polish-compon…
jerelmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,11 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const Block = ({ children }) => <div className={styles.block}>{children}</div>; | ||
|
||
Block.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Block; |
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,13 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const Bracket = ({ children }) => ( | ||
<span className={styles.bracket}>{children}</span> | ||
); | ||
|
||
Bracket.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Bracket; |
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,34 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cx from 'classnames'; | ||
import styles from './CodeDef.module.scss'; | ||
import Block from './Block'; | ||
import Bracket from './Bracket'; | ||
import Comment from './Comment'; | ||
import Identifier from './Identifier'; | ||
import Keyword from './Keyword'; | ||
import NumberValue from './Number'; | ||
import Operator from './Operator'; | ||
import StringValue from './String'; | ||
import Type from './Type'; | ||
|
||
const CodeDef = ({ className, children }) => ( | ||
<code className={cx(styles.container, className)}>{children}</code> | ||
); | ||
|
||
CodeDef.propTypes = { | ||
className: PropTypes.string, | ||
children: PropTypes.node, | ||
}; | ||
|
||
CodeDef.Block = Block; | ||
CodeDef.Bracket = Bracket; | ||
CodeDef.Comment = Comment; | ||
CodeDef.Keyword = Keyword; | ||
CodeDef.Identifier = Identifier; | ||
CodeDef.Number = NumberValue; | ||
CodeDef.Operator = Operator; | ||
CodeDef.String = StringValue; | ||
CodeDef.Type = Type; | ||
|
||
export default CodeDef; |
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,41 @@ | ||
.container { | ||
display: block; | ||
line-height: 2; | ||
} | ||
|
||
.identifier { | ||
color: var(--color-neutrals-700); | ||
} | ||
|
||
.type { | ||
padding: 0.125rem; | ||
border-radius: 0.125rem; | ||
color: var(--color-green-500); | ||
background: var(--color-green-050); | ||
} | ||
|
||
.comment { | ||
color: var(--color-neutrals-500); | ||
|
||
> p { | ||
display: inline; | ||
} | ||
} | ||
|
||
.keyword, | ||
.bracket, | ||
.operator { | ||
color: var(--color-neutrals-600); | ||
} | ||
|
||
.block { | ||
margin-left: 1rem; | ||
} | ||
|
||
.string { | ||
color: var(--color-green-500); | ||
} | ||
|
||
.number { | ||
color: var(--color-red-400); | ||
} |
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,32 @@ | ||
import React, { Children } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Markdown from 'react-markdown'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const Content = ({ children, ...props }) => { | ||
if (Children.toArray(children).length === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<span {...props} className={styles.comment}> | ||
{`//`} {children} | ||
</span> | ||
); | ||
}; | ||
|
||
const renderers = { | ||
root: Content, | ||
}; | ||
|
||
const Comment = ({ text }) => <Markdown source={text} renderers={renderers} />; | ||
|
||
Content.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
Comment.propTypes = { | ||
text: PropTypes.string, | ||
}; | ||
|
||
export default Comment; |
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,13 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const Identifier = ({ children }) => ( | ||
<span className={styles.identifier}>{children}</span> | ||
); | ||
|
||
Identifier.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Identifier; |
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,13 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const Keyword = ({ children }) => ( | ||
<span className={styles.keyword}>{children}</span> | ||
); | ||
|
||
Keyword.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Keyword; |
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,13 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const NumberValue = ({ value }) => ( | ||
<span className={styles.number}>{value}</span> | ||
); | ||
|
||
NumberValue.propTypes = { | ||
value: PropTypes.number.isRequired, | ||
}; | ||
|
||
export default NumberValue; |
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,13 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const Operator = ({ children }) => ( | ||
<span className={styles.operator}>{children}</span> | ||
); | ||
|
||
Operator.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Operator; |
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,13 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const StringValue = ({ value }) => ( | ||
<span className={styles.string}>"{value}"</span> | ||
); | ||
|
||
StringValue.propTypes = { | ||
value: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default StringValue; |
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,11 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './CodeDef.module.scss'; | ||
|
||
const Type = ({ children }) => <span className={styles.type}>{children}</span>; | ||
|
||
Type.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Type; |
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 @@ | ||
export { default } from './CodeDef'; |
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,22 +1,19 @@ | ||
.container { | ||
color: var(--color-neutrals-500); | ||
font-family: var(--code-font); | ||
color: var(--color-neutrals-600); | ||
font-size: 0.875rem; | ||
line-height: 1.5; | ||
margin-top: 2rem; | ||
|
||
&:not(:last-child) { | ||
margin-bottom: 2rem; | ||
} | ||
} | ||
|
||
.name { | ||
font-size: 1rem; | ||
font-family: var(--primary-font-family); | ||
color: var(--color-neutrals-800); | ||
font-weight: normal; | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
.block { | ||
margin-left: 0.5rem; | ||
} | ||
|
||
.constantContainer { | ||
margin: 0 0 1rem 1.5rem; | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on doing this for the reuse/flexibility/consistency 💯