Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Allow icons to be changed by the user#74

Merged
tabby-or-not merged 15 commits into
masterfrom
feature/icons-override
Oct 18, 2018
Merged

Allow icons to be changed by the user#74
tabby-or-not merged 15 commits into
masterfrom
feature/icons-override

Conversation

@tabby-or-not
Copy link
Copy Markdown
Contributor

@tabby-or-not tabby-or-not commented Oct 17, 2018

Remove dependency on font awesome 4 by allowing users to specify their own icons using the icons prop. This overrides only those specified.

i.e.

<ObjectList icons={{FavouritesIcon: <MyFavourites />}} />

Defaults added for FA4 FA5, use:

import {FontAwesome} from 'react-object-list/icons'
<ObjectList icons={FontAwesome(5)} />

This will check if the required version of font awesome is loaded in the DOM and warn if not.
Either way it'll apply the icons you picked (so as not to cause problems for false negatives)

@tabby-or-not tabby-or-not added the enhancement New feature or request label Oct 17, 2018
@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 17, 2018

Codecov Report

Merging #74 into master will decrease coverage by 0.37%.
The diff coverage is 90.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #74      +/-   ##
==========================================
- Coverage   95.54%   95.16%   -0.38%     
==========================================
  Files          60       60              
  Lines         718      745      +27     
  Branches      171      175       +4     
==========================================
+ Hits          686      709      +23     
- Misses         21       25       +4     
  Partials       11       11
Impacted Files Coverage Δ
src/pagination/Pagination.js 100% <ø> (ø) ⬆️
src/actions-filters/ActionsFiltersContainer.js 93.33% <ø> (ø) ⬆️
src/ObjectList.js 100% <ø> (ø) ⬆️
src/actions-filters/FiltersContainer.js 100% <100%> (ø) ⬆️
src/data-renderers/HeaderField.js 100% <100%> (ø) ⬆️
src/data-renderers/TableHeader.js 100% <100%> (ø) ⬆️
src/actions-filters/Favourites.js 100% <100%> (ø) ⬆️
src/filters/utils/makeFilter.js 100% <100%> (ø) ⬆️
src/actions-filters/OptionalFields.js 93.75% <100%> (+0.64%) ⬆️
src/filters/utils/RemoveFilter.js 100% <100%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e01426f...7fe53aa. Read the comment docs.

@tabby-or-not tabby-or-not requested a review from jarekwg October 17, 2018 05:33
Copy link
Copy Markdown
Member

@jarekwg jarekwg left a comment

Choose a reason for hiding this comment

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

Looks great. Awesome stuff!

Comment thread .storybook/webpack.config.js
Comment thread demo-site/table-demo.jsx
Comment thread src/ObjectList.demo.stories.js Outdated
updateFilter={this.updateFilter}
searchKey="first_name"
itemOnClick={action('clicked on')}
icons={FontAwesomeIcons(5)}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this supposed to be inconsistent with the other place? FontAwesome(4) vs FontAwesomeIcons(5)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, forgot to update this after adding the index file

Comment thread src/ObjectList.js
Pagination: DefaultPagination,
ErrorMessage: DefaultErrorMessage,
data: [],
icons: {},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since the css file that we publish with the js already has FA included, I do think we should have some defaults set up to work out of the box.

Copy link
Copy Markdown
Contributor Author

@tabby-or-not tabby-or-not Oct 17, 2018

Choose a reason for hiding this comment

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

Not any more 😈
https://github.com/uptick/react-object-list/pull/74/files#diff-5fea21b08a353ec25a50a2178f880439L1

Default is currently no icons so that there is no dependency, but we could revert that, thoughts @scaredcat @jarekwg ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep I like it. As long as there are still icons in the demo, we're good.
Maybes also adjust the main README to explain how this package treats icons now (import your own, feed them into the props)

Comment thread src/icons/FontAwesome.js
span.style.display = 'none'
document.body.insertBefore(span, document.body.firstChild)

const css = (element, property) => window.getComputedStyle(element, null).getPropertyValue(property)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🆒

@furious-luke furious-luke force-pushed the feature/icons-override branch from 01a658d to 7fe53aa Compare October 18, 2018 00:44
@tabby-or-not tabby-or-not merged commit 7cb4f7b into master Oct 18, 2018
@tabby-or-not tabby-or-not deleted the feature/icons-override branch October 18, 2018 05:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants