Posts

Showing posts with the label design

How to create an adaptive button in Figma?

Image
Clash Royale CLAN TAG #URR8PPP How to create an adaptive button in Figma? I just want to create a simple button with background color and text inside it, so that the width of the button will adapt to the text inside it. So lets say I have a button 56px wide with text saying "cancel" in it, but if I change the text to "Please click here to cancel and bla bla bla" - I'd then have to manually resize the button's background to match the new text. Is there a way to automate this part of the design process? PS: sorry for the irrelevant tags, but there is no tag "Figma" here. This question is for Figma users only! 2 Answers 2 The dynamic button function doesn't exist yet in Figma. SketchApp have some plugin that help you doing the job. There is an unofficial way how to do this using Figma's unreleased Stacks feature. Post on spectrum.chat: https://spectrum.chat...

JavaScript design using two arrays v.s. one object array, the pron and corn?

Image
Clash Royale CLAN TAG #URR8PPP JavaScript design using two arrays v.s. one object array, the pron and corn? Let us consider performance, design, readable, what is the better design for JavaScript? Question is that keep a key value table! design one: key= ['A', 'B', 'C', 'D'] value = [1, 2, 3, 4] design two: map = {'A':1, 'B':2, 'C':3, 'D':4] design three map = [ ['A', 1], ['B', 2], ['C', 3], ['D', 4]] design four: data = [{key:'A', value:1}, {key:'B', value:2}, {key:'C', value:3},{key:'D', value:4}] My colleague say 'design one' is the best, because it keep simple, no redundant object, easy to access by index, and have best performance because JavaScript access array is faster than access Map. However, I think that we need to put relationship data together in order to reach Encapsulation. I don't known how more time be waste if using Map? Is it rea...