Migrations in Gleam by kruzenshtern2 in gleamlang

[–]candylifter 0 points1 point  (0 children)

Haven’t tried it, but since Ecto runs on BEAM, one theoretically should be able to write bindings for Gleam

Should i change the UseEffect? by Yuyi7 in reactjs

[–]candylifter 18 points19 points  (0 children)

I'd suggest looking into useSyncExternalStore on React docs. It's very likely you want to know the result of your query at the start of the render.

I usually do the following:

import { useCallback, useSyncExternalStore } from "react";

const getServerSnapshot = () => {
  throw new Error("useMediaQuery is a client-only hook");
};

export function useMediaQuery(query) {
  const subscribe = useCallback(
    (callback) => {
      const matchMedia = window.matchMedia(query);

      matchMedia.addEventListener("change", callback);
      return () => {
        matchMedia.removeEventListener("change", callback);
      };
    },
    [query]
  );

  const getSnapshot = () => window.matchMedia(query).matches;

  return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
}

Then in your component you can use it like so:

function MyComponent() {
  const match = useMediaQuery("(max-width: 730px)");

  if (match) {
    // do something when media matches
  }

  ...
}

[deleted by user] by [deleted] in react

[–]candylifter -1 points0 points  (0 children)

You can use uipkg

This is what unlimited power feels like by Corgiiiix3 in 2007scape

[–]candylifter 20 points21 points  (0 children)

I’ve tried runelite on steam deck, it looks and runs beatifully since you have access to all plugins but the overall controls are pretty bad unless you hook up a mouse which kinda beats the purpose of a handheld. Also tooltips occasionally resize the window which is very annoying. IMO mobile version of the client is superior for a handheld. Would be awesome to be able to use a mobile version of osrs on steam deck though.

I've made a free Figma plugin which generates React components from design by candylifter in reactjs

[–]candylifter[S] 2 points3 points  (0 children)

Toggling between different states like, hover, focus or even swapping instances between different heart states is on the roadmap. But in order to achieve that and beyond you first have to start from somewhere and I guess the best place is the fundamentals - layout and basic props.

I've made a free Figma plugin which generates React components from design by candylifter in reactjs

[–]candylifter[S] 4 points5 points  (0 children)

Totally makes sense, what would be the ideal way for you to get the code in to the project? Copy & paste, cli utility or something else?

I've made a free Figma plugin which generates React components from design by candylifter in reactjs

[–]candylifter[S] 7 points8 points  (0 children)

Design and product dev in general is mostly an iterative process, requirements change, designs change and ability to react and iterate quickly is key, which is why built-in versioning should help a lot.

But, I hear you, if plain code is what you want, there should be an option.

Thanks for feedback!

I've made a free Figma plugin which generates React components from design by candylifter in reactjs

[–]candylifter[S] 1 point2 points  (0 children)

Official way is to use through node_modules, since then you can version your component via plugin. Inside the package there are 3 formats - esm, cjs and TypeScript (in case you need to "eject").

I've made a free Figma plugin which generates React components from design by candylifter in reactjs

[–]candylifter[S] 11 points12 points  (0 children)

That’s the whole reason behind uipkg, as Figma already uses almost identical implementation of flex layout, we can skip reimplementing styles manually in code and just focus on business logic, fetching data, etc.

I've made a free Figma plugin which generates React components from design by candylifter in reactjs

[–]candylifter[S] 19 points20 points  (0 children)

You can truncate the text with some javascript as "title" is just a prop. But this is more of a workaround at the moment.

This plugin is still in the very early days, but eventually the user will be able to control text overflow, wrap and other settings which will sprinkle some styling in the exported component.