|
Tei posted:I find the => operator ugly
|
# ¿ Nov 26, 2020 07:40 |
|
|
# ¿ May 9, 2024 15:48 |
|
uncle blog posted:
|
# ¿ Dec 4, 2020 23:04 |
|
I can't seem to appreciate any other front-end framework's template syntax now after using JSX for a few years. It all looks like yucky old mustache or angular 1.x to me.
|
# ¿ Jan 14, 2021 01:45 |
|
A 50-something KB JSON is probably smaller than most of the images on your page. Sure, it has some parsing cost, but it's a negligible amount. It's certainly not a big enough problem to be worth exploring other encoding formats which would require custom parsing code and likely result in the same if not worse performance. Sticking with JSON gives you a native parser implementation from the browser.
|
# ¿ Feb 25, 2021 17:32 |
|
For small clients, grab a reseller account from MXRoute to sell to them.
|
# ¿ Feb 26, 2021 00:42 |
|
Given the target audience is low income high school students, I don't know if assuming they have SMS access is a great idea. Even if they or a parent do have a phone, it might be a prepaid without any minutes on it.
|
# ¿ Mar 10, 2021 02:41 |
|
That will only strip out the first space character. Also, the + should probably go inside the capture group. I'm gonna recommend something more like this: code:
Putting optional leading/trailing whitespace at the start and end of the regex is generally a bad look and in some situations can open you up to regex denial-of-service attacks, so I agree that trimming the string beforehand with .trim() or even stripping spaces as a pre-processing step is probably a good idea. Then the regex would become: Assuming a trimmed string (.trim()): code:
code:
Ima Computer fucked around with this message at 16:27 on Mar 25, 2021 |
# ¿ Mar 25, 2021 16:24 |
|
Biowarfare posted:all/most browsers already alias $ to querySelector and $$ to querySelectorAll
|
# ¿ Apr 13, 2021 23:00 |
|
Skyarb posted:Any ideas? You could add a wrapper element around your padding-aspect-ratio-ed element with a max-height/max-width. Or maybe you could add the max-dimension styles to the element itself and move the padding into a ::before pseudo-element? Ima Computer fucked around with this message at 23:41 on Apr 16, 2021 |
# ¿ Apr 16, 2021 23:37 |
|
marumaru posted:Forgive my ignorance, what's a managed VPS? For a VPS, a "managed" offering would mean that someone who isn't you would take care of all the software installation, configuration, updates, security patches, etc for you. DigitalOcean's droplets are an example of an "unmanaged" VPS, where they just give you the credentials to access the server and from there you're on your own.
|
# ¿ May 7, 2021 00:07 |
|
Anony Mouse posted:Ok hold up. iOS 15 Safari now floats the navbar over the bottom of the page? It seems to collapse when you scroll, but who the hell thought it was a good idea to overlay browser chrome directly over webpage content? This is one of the dumbest design decisions I've seen, and directly interferes with the usability of webpage content and interfaces at the bottom of the viewport. My tinfoil hat theory is that they're trying to force people to start using env(safe-area-inset-bottom) in their CSS.
|
# ¿ Jun 17, 2021 02:15 |
|
fuf posted:Any suggestions on how to accomplish this? I can crop the video by setting its width or height to >100%, but I can't figure out how to set like a "max crop". There's no way to do this with pure CSS... at least not until container queries are a thing. Use a ResizeObserver to detect when the container <div> changes dimensions. Calculate the aspect ratio of the div, and then toggle a class on the <video> that swaps between object-fit: cover and object-fit: contain based on whether or not the aspect ratio is within a certain range (plus or minus some % of the video's original aspect ratio).
|
# ¿ Dec 6, 2021 20:01 |
|
box-shadow lets you create complete and partial borders without affecting the dimensions.
|
# ¿ Dec 11, 2021 02:48 |
|
box-sizing: border-box doesn't matter. Borders will always stack on top of your defined dimensions. And if you ever need to hide/show the borders on the fly, you end up needing to make up for the lost/gained space by tweaking the padding or margin, or else you get shifting: https://jsfiddle.net/16eztcqr/
|
# ¿ Dec 11, 2021 20:53 |
|
Lumpy posted:That is incorrect. border-box makes borders fit inside the defined width / height.
|
# ¿ Dec 11, 2021 22:18 |
|
Here's another example of borders being annoying, even with defined dimensions. A list of items with identical padding where some of the items are highlighted with a border. If you avoid using an actual border, you don't need to worry about adjusting your padding so that the content of each item still lines up: https://jsfiddle.net/uxdaw01L/
|
# ¿ Dec 11, 2021 23:20 |
|
A transparent border is still an unintuitive hack and still impacts the layout, since it effectively becomes additional padding on the element. If you're using a strict design system with a scale of spacing values, it feels bad to define bespoke spacing to accommodate a border on an element (or worse, to put a calc() in there). It's not without it's trade-offs (mostly the convoluted syntax, which can be worked around with a SCSS mixin or a CSS-in-JS utility function) but if you want the ability to set a border without impacting the layout, or to set an inset border, using box-shadow can be worth it.
|
# ¿ Dec 12, 2021 00:44 |
|
htmlFor is always going to be a thing too. Both of those alternative identifiers for HTML attributes have their roots in the DOM (see: Element.className, HTMLLabelElement.htmlFor)
|
# ¿ Jan 25, 2022 06:56 |
|
LifeLynx posted:- I noticed there's a lot of rerenders, and I think it's because of the cursor component, namely the useMouse hook. It constantly needs to update the state of the position. On top of that, certain things use the ImageHover component, which also updates the global state (useContext) in order to change the styling of the cursor so it doesn't visually block buttons or photos. My question is, is the rerendering just an unavoidable tradeoff for having a cool cursor effect? I saw a lot of sites on Awwwards using the same effect and wanted to see if I could replicate it. Calling useMouse at pretty much the root of the application (in your Layout component) means that you're re-rendering the entire page for every mouse position update. Since the only thing that needs to re-render when the mouse moves is the circle element, you could move rendering code for that element and the useMouse hook call into it's own component, and pass the ref from the Layout component to it as a prop. It should be a big performance improvement. Changes to overButton state will still trigger a re-render of the entire page, but considering that occurs far less frequently than mouse position updates, it's a lot less of a concern.
|
# ¿ Jan 26, 2022 03:29 |
|
tRPC has gotten popular enough that people are trying to reimplement the tRPC developer experience for GraphQL servers now.
|
# ¿ Mar 4, 2023 06:33 |
|
Lumpy posted:Because I'm lazy and didn't read the documentation, does tRPC require your front and back end be in he same repo? Ima Computer fucked around with this message at 12:27 on Mar 5, 2023 |
# ¿ Mar 5, 2023 12:23 |
|
I moved all my domains to Porkbun a while back because they had reasonably competitive pricing and a cute pig mascot. Would recommend.
|
# ¿ Aug 1, 2023 14:56 |
|
Polio Vax Scene posted:Trying to get npm build to get my output files juuust right... Webpack is painful to configure, even for those of us who've been doing it for years. And it's especially awkward to try to patch an existing config from create-react-app. I think there's a solution for your problem that doesn't involve fiddling with webpack though. According to this docs page, you can add this line to your package.json to build for relative paths: JSON code:
Polio Vax Scene posted:For context I just started trying to learn how to use React and npm yesterday so I have no idea wtf I'm doing I would recommend considering checking out some other options besides create-react-app - it's no longer maintained, supported, or recommended anymore. The docs currently recommend starting out with a framework like Next.js, but if a framework is overkill, Vite's react template is a strong replacement for create-react-app, and also much easier to configure and customize.
|
# ¿ Aug 23, 2023 03:38 |
|
As a general rule, you should always include a text label on your inputs. The only time you can reasonably exclude them is if there are other context clues that make it clear what the intent of the input is, such as submit buttons that are paired exclusively with that input, or iconography. For example, google's homepage doesn't put a label on their search field, because the icon on the input and labels of submit buttons make it obvious what that input is for. You should still include an aria label for screen readers even if you find a case where you can exclude the visual label though. kedo posted:I've thought about going the moving label/fake placeholder route (where the label pretends to be a placeholder and then, upon field focus, it moves up and out of the way of the field which was all the hotness maybe 5-10 years ago) This is what Material Design does. It's fine, but it still requires that designers accommodate for the space of the label when the field is populated by a value. kedo posted:most of the forms I deal with allow for non-devs to edit the label text, so there's a distinct possibility of someone putting 200 characters into a label or something like that.
|
# ¿ Nov 13, 2023 18:38 |
|
kedo posted:Any ideas? I'm going nuts over here. Most likely the issue is being caused by a shared reference to an object somewhere where there shouldn't be, but I wasn't able to identify the origin of it, based on your modified code sample. Does anything change if you call marker.setIcon() instead of this.setIcon() I would also try attaching the event directly to the marker (which looks like it should be supported, according to the docs) JavaScript code:
|
# ¿ Dec 5, 2023 22:45 |
|
America Inc. posted:In my mind, React works like this: you've got a hierarchy of components, each with their own state. When the state of the parent updates, the children are re-mounted, and the state is reset to initial values. If you want to force a component to be remounted/reset like that, the easiest thing to do is probably to throw the value of query into the key prop: JavaScript code:
|
# ¿ Apr 21, 2024 20:56 |
|
|
# ¿ May 9, 2024 15:48 |
|
prom candy posted:Also not sure exactly what you're doing...
|
# ¿ Apr 22, 2024 19:10 |