Comments (16)
could you provide more information for this issue
from octicons-modular.
This is solely a nodejs library for now. I'm working on components for specific front-end framework like React or Vue. So we can make it easier to use the library, e.g.
const element = <Octicon :icon="zap" />;
from octicons-modular.
How can i help?
from octicons-modular.
@QuadDepo You may want to implement a React component with tests and examples based on the given idea.
from octicons-modular.
sure!
from octicons-modular.
Do you want to keep it the same way? rendering SVG or access it with fonts/classes?
from octicons-modular.
@QuadDepo It should render the SVG with two properties:
- icon (the octicon object)
- scale
You may want to see this #5
from octicons-modular.
hey man, i worked some stuff out. Still very basic. But after i knew how you were doing it i got the hang of it. Might wanna checkout my fork and check if i'm the in the right direction.
I was thinking of having a .json file with all names and paths to it.
from octicons-modular.
@QuadDepo First of all, thank you for taking your time addressing this issue. There are things I think we can improve:
- Bundler: "Use Webpack for apps, and Rollup for libraries". I think it's totally fine to write React components using Rollup. The combination of Webpack and Rollup in a single library is a little bit overwhelming.
- Validation: We don't need to check for icon existence. The only thing we care is the icon object itself and its
svg
method. Therefore, we may not need a reference to the icon set.
from octicons-modular.
Thanks for the feedback, im not used to use react to build libraries. I will take a look at RollUp.
How do you mean with
we may not need a reference to the icon set.
Is making a .json for the icons a bad thing?
from octicons-modular.
@QuadDepo I mean this
https://github.com/QuadDepo/octicons-modular/blob/3c94e4c59234fc6360308c24be2133c744e5dd8e/react/src/Octicon.js#L27-L40
We don't have to double check with the icons
array in https://github.com/QuadDepo/octicons-modular/blob/3c94e4c59234fc6360308c24be2133c744e5dd8e/react/src/icons.js
from octicons-modular.
I think i tried it without it. React throws an error with cant read property of
from octicons-modular.
@QuadDepo Could you send me the full error stack and a screenshot :D
from octicons-modular.
@QuadDepo This is an equivalent component to the VueJS one I could think of. Any suggestions?
import PropTypes from 'prop-types'
import { Component } from 'react'
import 'octicons/build/octicons.min.css'
class Octicon extends Component {
constructor(props) {
super(props)
this.state = {
// No state needed, for now
}
}
render() {
const {
icon,
scale
} = this.props
return (
<span dangerouslySetInnerHTML={ icon.svg({ scale: scale }) }></span>
)
}
}
Octicon.propTypes = {
icon: PropTypes.shape({
svg: PropTypes.func
}),
scale: PropTypes.number
}
Octicon.defaultProps = {
icon: {
svg () {
return
}
},
scale: 1
}
from octicons-modular.
Looks good to me.
from octicons-modular.
@QuadDepo Could you try it with your fork? Thanks.
from octicons-modular.
Related Issues (20)
- Octicon additional class test fails
- Development script
- VueJS component
- Splitting components into smaller libraries HOT 2
- Readme outdated HOT 3
- More icon tests HOT 2
- Icon tests with different scales HOT 5
- ES module tests HOT 1
- More unit tests HOT 6
- ES module bundle renaming HOT 1
- Warning of auto-generated files in src directory HOT 3
- Known Vulnerabilities badge HOT 3
- Missing dev dependency to `babel-cli` [babel-node: command not found] HOT 1
- Factory elimination over pure-object icons for better tree-shaking HOT 1
- Demo using GitHub Pages HOT 5
- Allow to set float number as scale value HOT 8
- UMD and/or IIFE modules
- Icon test refactoring HOT 13
- Webpack tree-shaking does not work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from octicons-modular.