Coder Social home page Coder Social logo

Improve Default Toolbar Styling about gm3 HOT 7 CLOSED

geomoose avatar geomoose commented on August 28, 2024
Improve Default Toolbar Styling

from gm3.

Comments (7)

theduckylittle avatar theduckylittle commented on August 28, 2024

gm3.less will need to include the new toolbar.less for the changes to be visible.

from gm3.

CaitW avatar CaitW commented on August 28, 2024

@theduckylittle, I noticed in the example mapbook file that the print tool has an attribute icon-class. Were you planning on specifying icons for each tool from within the mapbook?

from gm3.

theduckylittle avatar theduckylittle commented on August 28, 2024

The mapbook has a lot of left-overs. These shouldn't be any additional icon-class attributes.

from gm3.

CaitW avatar CaitW commented on August 28, 2024

How would you like me to link specific icons to their respective toolbar tool?

If we kept the icon-class attribute, it would require two small changes to render that icon:

src/gm3/actions/toolbar.js:51

iconClass: toolXml.getAttribute('icon-class')

src/gm3/components/toolbar.jsx:63

<span className="icon"><i className={tool.iconClass}></i></span>

from gm3.

theduckylittle avatar theduckylittle commented on August 28, 2024

Yes, but the icon itself is not important. Styling the button is more important and the button always has an icon whether or not it's rendered (which can be determined by CSS). I think we need to just change one line of code, https://github.com/geomoose/gm3/blob/master/src/gm3/components/toolbar.jsx#L61, to something like:

<button onClick={tool_click} key={tool.name} className={'tool tool-'+tool.name}>

I just rambled off the above, it may work, it may have a syntax error, it may light your CPU on fire. In any of those three equally likely scenarios, it adds the styling to the buttons in a way that is predictable to customize.

The above code also makes the LESS pretty easy. To control the default icon:

.tool {
 .icon {
   display: none;
 }
}

To control a specific icon:

.tool-print {
 /* other styling here, e.g. */
 color: red; /* this would be ugly but noticeable, and changes the icon AND text color */
 .icon {
 }
}

Happy coding.

from gm3.

theduckylittle avatar theduckylittle commented on August 28, 2024

Related PR: #16

from gm3.

theduckylittle avatar theduckylittle commented on August 28, 2024

With the PR merged, I'm closing this one out.

from gm3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.