Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Love Stole the Day posted:

I' m stealing this

I forget where I stole it from, otherwise I'd give that person (who probably stole it from someone else...) credit. I have a VIM snippet to make them :swoon:

Adbot
ADBOT LOVES YOU

kedo
Nov 27, 2007

Lumpy posted:

The key thing is that you can't mount / render a TransitionGroup directly. It has to be inside something.

This is what I do for my loading screen and it works just ducky:

JavaScript code:
...

That looks helpful... how is it actually applied when you need to load something? <LoadingPane loading=?? message="foobar" subtext="baz" /> in your render? Pretend I know nothing.

Could I theoretically pass a component or div filled with stuff instead of "message"?

kedo fucked around with this message at 17:02 on Nov 15, 2017

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Well, I read the manual and it seems pretty clear that is has to wrap the component being (un)mounted, not be part of the tree that's being unmounted https://reactjs.org/docs/animation.html#animation-group-must-be-mounted-to-work

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

kedo posted:

That looks helpful... how is it actually applied when you need to load something? <LoadingPane loading=?? message="foobar" subtext="baz" /> in your render? Pretend I know nothing.

Could I theoretically pass a component or div filled with stuff instead of "message"?

Here's a truncated example of LoadingPane in use:

JavaScript code:
// SomePage.js

import { connect } from 'react-redux';
import LoadingPane from '../../common/LoadingPane';
import { 
  myData, 
  isThisThingLoading, 
  errorMessage 
} from './selectors';

const mapStateToProps = ( state ) => ({
    loading: isThisThingLoading( state ),
    data: myData( state ),
    error: errorMessage( state ),
})

// a person smarter than me would abstract this into a
// PageWithLoadingScreen component!
const SomePage = ({ loading, data, error }) => (
    <div>
        { (!loading && data) && (
             <ComponentToShowData data={ data } />
        ) }
        { (!loading && error ) && (
             <ComponentToShowError error={ error } />
        ) }
        <LoadingPane 
          loading={ loading } 
          message="I am getting data!" 
          subtext="(it will totally be worth the wait!)" 
        />
   </div>
)
export default connect( mapStateToProps )( SomePage );
And yes you can pass anything you want into components, or just make LoadingPane take children as a prop and do it up like:

code:
<LoadingPane 
      loading={ loading } 
>
       <SomeOtherThing>Farts</SomeOtherThing>
       <img src={ butt } />
</LoadingPane>
EDIT: Then LoadingPane looks like:
JavaScript code:
const LoadingPane = ({ loading, children }) => (
    <div>
    <CSSTransitionGroup 
      transitionName="loadingPaneTransition" 
      transitionEnterTimeout={50} 
      transitionLeaveTimeout={250}
    > 
        { loading && (
        <div className="loadingPane">
            { children }
        </div>
        )}
    </CSSTransitionGroup>
    </div>
);

Lumpy fucked around with this message at 17:22 on Nov 15, 2017

kedo
Nov 27, 2007

Lumpy posted:

Here's a truncated example of LoadingPane in use:

Thanks! I'm going to futz around with this to see if I can get it running. Much appreciated.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
I'm trying to make an ordered list where the items have 0, 1, 2, or 3 supplementary 'bullets' (little hot-pepper icons) to the left of the numbers. I'm not having much success.

I tried some fiddling with a repeated background image on the ::before attribute, but that seemed like a dead end because I'm specifically targeting a print stylesheet here, and browsers make weird decisions about printing (or not printing) background images.

Anyone want to look at this fiddle, which shows some of the problems I'm having?

edit: My preference would be to achieve the desired effect by just attaching the 'medium', 'hot', 'spicy' classes to the 'question' <li> elements, but that seems like it'd be harder.

Newf fucked around with this message at 00:11 on Nov 20, 2017

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.
Umm, something like this possibly, using CSS counters & ::before? Not sure how it plays with print though, so best check. JSFiddle does something wierd when I try to put this code in, so done on CodePen:

https://codepen.io/DanielCouper/pen/zPRKvM

* Remove the list styling (to replace the automatic numbering with counter-generated numbers)
* Set up a CSS counter on the ol
* set the ::before of each list item to a specific width so you can right-align the peppers/number
* use `content: "🌶️ " counter(section);` with however many peppers are necessary for each class
* obvs replace the pepper emoji with something image-based or font-based, whatever works

RobertKerans fucked around with this message at 12:28 on Nov 20, 2017

fuf
Sep 12, 2004

haha
Is the only way to test event tracking in Google analytics to wait until the next day to see if any new events have registered? No way to check real-time if / how events are being sent?

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



There is a debugger plugin for Chrome ​https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna (if that doesn't work, just search for it in the app store)

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


Material UI (Next) vs Ant Design. Anyone used these?

I mean I have read some people in this thread mention Material UI. How’s your experience been? Did you use the beta version of the upcoming V1?

Anyone used Ant Design instead? Looks almost more robust than Material UI but not sure it’ll win as mainstream. It’s also not US based which means features / translations are English second.

Chenghiz
Feb 14, 2007

WHITE WHALE
HOLY GRAIL

Ruggan posted:

Material UI (Next) vs Ant Design. Anyone used these?

I mean I have read some people in this thread mention Material UI. How’s your experience been? Did you use the beta version of the upcoming V1?

Anyone used Ant Design instead? Looks almost more robust than Material UI but not sure it’ll win as mainstream. It’s also not US based which means features / translations are English second.

Assuming you're talking about react libraries, I used material-ui a couple years ago and was extremely unimpressed with it, specifically how it handles themes and colors. Huge pain in the rear end. Maybe it's better now. React-md looks like it may be a better option if you want to go the Material route: https://react-md.mlaursen.com/

We use semantic-ui at work now and I really have no complaints, it's very comprehensive, easily extended, the docs are great, and it looks great: https://react.semantic-ui.com/

Love Stole the Day
Nov 4, 2012
Please give me free quality professional advice so I can be a baby about it and insult you
Re: React tools

Not sure if everybody here is aware of this or not, but the other day I found a great site that sort of aggregates React-related libraries: https://devarchy.com/react

CarForumPoster
Jun 26, 2013

⚡POWER⚡
What do people use when you have a team of 2 or 3 people working on the same project to not step on each others toes while editing files?

duz
Jul 11, 2005

Come on Ilhan, lets go bag us a shitpost


Source control.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

duz posted:

Source control.

This is the main part (I would go with gitlab or bitbucket). The other part is having a well organized codebase, automated tests, and CI pipeline. Good communication and a little coordination can go a long way to avoid annoying merge conflicts as well.

The Dave
Sep 9, 2003

Also getting the whole team to read and understand a methodology for using source control and agreeing with it, so it's not a wild west of branches.

CarForumPoster
Jun 26, 2013

⚡POWER⚡
Gonna watch this:

https://www.lynda.com/Git-tutorials...oducttypeid%3a2

Thanks everybody.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

I found this helpful too when I switched over to git:

https://www.atlassian.com/git/tutorials/what-is-version-control ( <- intro to the whole concept of Source Control and what git is)

https://www.atlassian.com/git/tutorials/setting-up-a-repository ( <- jump to the "I know what git is, just tell me how to use it!)

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Lumpy posted:

I found this helpful too when I switched over to git:

https://www.atlassian.com/git/tutorials/what-is-version-control ( <- intro to the whole concept of Source Control and what git is)

https://www.atlassian.com/git/tutorials/setting-up-a-repository ( <- jump to the "I know what git is, just tell me how to use it!)

Nice, I was already planning on JIRA service desk for trouble tickets and knowledge base, so it looks like Ill just load up with atlassian.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

also there's the VCS thread which just recently touched on understadning git.

https://forums.somethingawful.com/showthread.php?noseen=0&threadid=3113983&perpage=40&pagenumber=86#pti38

CarForumPoster
Jun 26, 2013

⚡POWER⚡

This website does fuckin everything.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

CarForumPoster posted:

This website does fuckin everything.

Well, it used to. Then they got rid of the porn and :filez: Still pretty good though.

The Fool
Oct 16, 2003


The likelihood of SA being still around today if they had kept btb and hpj is basically 0.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

The Fool posted:

The likelihood of SA being still around today if they had kept btb and hpj is basically 0.

Absolutely! But they were nice while they lasted. SA is pretty drat amazing even without them though.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

The Fool posted:

The likelihood of SA being still around today if they had kept btb and hpj is basically 0.

Back in ~2008 under one of my old usernames I had access to one of the goon private trackers but I didnt use it for a few years and got banned on SA and now I've long forgotten what it was and who gave me access.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

RobertKerans posted:

Umm, something like this possibly, using CSS counters & ::before? Not sure how it plays with print though, so best check. JSFiddle does something wierd when I try to put this code in, so done on CodePen:

https://codepen.io/DanielCouper/pen/zPRKvM

* Remove the list styling (to replace the automatic numbering with counter-generated numbers)
* Set up a CSS counter on the ol
* set the ::before of each list item to a specific width so you can right-align the peppers/number
* use `content: "🌶️ " counter(section);` with however many peppers are necessary for each class
* obvs replace the pepper emoji with something image-based or font-based, whatever works

Hey - late reply, but thanks a lot. This has me on the right track.

Pollyanna
Mar 5, 2005

Milk's on them.


What’s the best way to display a max of N-lines of text and ellipsis the rest with only CSS? I’ve managed to get an element to break even an entire 150char word, but I want it to show a max of two line breaks and ellipse afterwards. I tried -webkit-line-clamp, but it didn’t work.

darthbob88
Oct 13, 2011

YOSPOS

Pollyanna posted:

What’s the best way to display a max of N-lines of text and ellipsis the rest with only CSS? I’ve managed to get an element to break even an entire 150char word, but I want it to show a max of two line breaks and ellipse afterwards. I tried -webkit-line-clamp, but it didn’t work.
Is this page helpful for you?

Pollyanna
Mar 5, 2005

Milk's on them.


I found what I did wrong there. :downs: thanks.

Knifegrab
Jul 30, 2014

Gadzooks! I'm terrified of this little child who is going to stab me with a knife. I must wrest the knife away from his control and therefore gain the upperhand.
What do you guys think is the best way to illustrate a required field in today's web? I know asterisks are obviously a pretty standard defacto but feel like they look ugly/out of place these days.

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


Two asterisks?

Knifegrab
Jul 30, 2014

Gadzooks! I'm terrified of this little child who is going to stab me with a knife. I must wrest the knife away from his control and therefore gain the upperhand.

Ruggan posted:

Two asterisks?

Gasp!

Also do you guys prefer to lock the submit button until all the necessary data is valid, or leave the button enabled and report errors?

bigmandan
Sep 11, 2001

lol internet
College Slice

Knifegrab posted:

Gasp!

Also do you guys prefer to lock the submit button until all the necessary data is valid, or leave the button enabled and report errors?

Generally I prefer to keep the button enabled and report errors. Doing it this way as it allows the user to explore the UI and receive feedback. A locked button may be to passive.

Also for forms, depending on the ratio of required/optional fields it may sometimes make sense to denote field(s) as optional implying all other fields are required.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself

Knifegrab posted:

What do you guys think is the best way to illustrate a required field in today's web? I know asterisks are obviously a pretty standard defacto but feel like they look ugly/out of place these days.

I like when a form will turn red as I'm typing and only go back to grey when the field is filled out correctly.

And then when you hit submit, all the incorrectly filled out fields turn red.

The Dave
Sep 9, 2003

Grump posted:

I like when a form will turn red as I'm typing and only go back to grey when the field is filled out correctly.

And then when you hit submit, all the incorrectly filled out fields turn red.

While this is my preference, i hate when you get the error while you're still typing.

Also locking the button and not reporting errors seems like a nightmare for accessibility.

Knifegrab
Jul 30, 2014

Gadzooks! I'm terrified of this little child who is going to stab me with a knife. I must wrest the knife away from his control and therefore gain the upperhand.

The Dave posted:

While this is my preference, i hate when you get the error while you're still typing.

Also locking the button and not reporting errors seems like a nightmare for accessibility.

Yeah agreed. It can make sense in some situations, but on others, like IP address validation, the user will get errors until they've fully completed the IP address, reporting errors while the user is still on the way to valid input feels bad IMO.

Also thanks for the tips, I think I know where to go from here.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me
If you can make the submit button give useful information on what is wrong, this is the best. Making fields turn red points out it is wrong, but you should also say why.

Pollyanna
Mar 5, 2005

Milk's on them.


Way I see it, no errors until you try to submit, since it’s not posting asynchronously while you’re filling it out.

The Fool
Oct 16, 2003


Pollyanna posted:

Way I see it, no errors until you try to submit, since it’s not posting asynchronously while you’re filling it out.

That's what client side validation is for?

Adbot
ADBOT LOVES YOU

Giga Gaia
May 2, 2006

360 kickflip to... Meteo?!
I just finished building a client side validation and form layout system for my current gig and here's what I've opted to do:

  • Write (required) in the label text
  • On submit, highlight the required invalid elements in our alert red and use the browser default error system to display a custom message where appropriate
  • On required radio buttons or checkboxes, the fieldset that contains them gets the red alert colors and the error message
  • On submit, highlight the non required but still invalid elements in our warning yellow, show the appropriate error but with a "leave blank" wording. This is currently being used on phone numbers in an example field. Might outright eliminate since this can always be filtered on the back end. But at the same time, if you mess up an optional phone number, its probably good feedback. Definitely an optional thing that we'll A/B test
  • When the user has fixed the error, the field highlights in our success green. It doesn't do this by default, only if you've made an error.
  • Currently we've got the same(basically) system running when you leave a field, not while you're typing just if you move on. I'm waffling back and forth on this and will probably just end up testing how it works with our user base.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply