kwicherbelliaken / better-brain-blogging

a personal blog logging my learnings as they come
0 stars 0 forks source link

[FEATURE]: improve the styling of the site #10

Closed slackermorris closed 1 year ago

slackermorris commented 1 year ago
body {
  margin: 0 auto;
  max-width: 50em;
  font-family: "Helvetica", "Arial", sans-serif;
  line-height: 1.5;
  padding: 4em 1em;
}
slackermorris commented 1 year ago

The site is not responsive at all. I need to ensure that the site is usable on mobile phones? Or I could just show an error page if the site is accessed on a phone in the meantime.

Yeah, what about just having a:

Sorry, I don't support mobiles

Perhaps with something like:

image

Or like this:

image

Or like this.

slackermorris commented 1 year ago

I could use react-device-detect to offer Desktop and Mobile specific UI's.

slackermorris commented 1 year ago

I want to add a background image to the do not support mobile Component.

In order to use images in Remix do I need to make use of Asset Preloading.

Or perhaps I import it directly and tag it as an image source? https://stackoverflow.com/questions/71015461/how-to-load-svg-components-in-remix-run-application/72928536#72928536

slackermorris commented 1 year ago

This doesn't seem right:

bg-[url('../../build/_assets/miguel-cruz-illustration-LGBWTWVJ.png')]

Surely I don't have to specify the build directory?

slackermorris commented 1 year ago

I think perhaps I should do the Remix Jokes Tutorial.

slackermorris commented 1 year ago

How to style a Remix app using just CSS

slackermorris commented 1 year ago

This is the exact issue that I have been having.

slackermorris commented 1 year ago

Perhaps my issue resides in not understanding the difference between relative and absolute paths?

slackermorris commented 1 year ago

It seems like people are having the same issue: https://github.com/tailwindlabs/tailwindcss/discussions/6617

slackermorris commented 1 year ago

I have left a comment on the tailwind forum so I will be watching the response on it.

The recommended fix didn't work. So I did string interpolation using.. I'm not too sure what. I think it is something native offered by Remix. But basically:

import image from '../public/image.png';

return {
     <div className={`... bg-[($image)]`}/>
}
slackermorris commented 1 year ago

I am moving onto trying to extract common styling from the level of the Component, e.g. Title, into Tailwind so that generic styles are managed via Tailwind.

This is a good resource.

O.K. I figured it out. I needed to point Tailwind to my entry CSS file, which makes use of CSS directives and to add custom CSS.

slackermorris commented 1 year ago

There are these annoying generated files server/_assets that I would like to get rid of. I'm not sure how..

Screen Shot 2023-02-04 at 12 17 00 PM
slackermorris commented 1 year ago

I intend to read more on styling best practices.

This is really interesting. Abstracting away styles:

import clsx from 'clsx';
import * as React from 'react';

export default function Tag({
  children,
  className,
  ...rest
}: React.ComponentPropsWithoutRef<'button'>) {
  return (
    <button
      className={clsx(
        className,
        'inline-block rounded-md px-1.5 py-0.5 font-medium transition-colors',
        'bg-gray-100 text-gray-700 hover:text-black disabled:bg-gray-200 disabled:text-gray-300',
        'focus:outline-none focus-visible:ring focus-visible:ring-primary-300 disabled:cursor-not-allowed'
      )}
      {...rest}
    >
      {children}
    </button>
  );
}

Is there an issue w/r/t passing and applying classNames as props? See the point made here.

slackermorris commented 1 year ago

There is a really annoying issue of there being scrolling on pages where scrolling need not be occurring. It might have something to do with setting the height of <body/> as that of the viewport.

slackermorris commented 1 year ago

I fixed the above by explicitly setting the height of the <body/> contents. Something like flex h-[calc(100vh-4rem)]. With 4rem being the height of the fixed-in-place header.

slackermorris commented 1 year ago

Some random style thoughts/links:

// [TYPEFACE]: // https://fontsinuse.com/uses/47122/paul-and-the-microcosm-wenzel-rehbach // https://fontsinuse.com/uses/46970/frow // https://fontsinuse.com/uses/43980/ekin-fil-aquarius-pisces-single-cover // https://fontsinuse.com/uses/45808/futurissimo-l-utopie-du-design-italien

// [IRREGULAR CSS SHAPES]: // https://stackoverflow.com/questions/23711059/trapezium-shape-with-rounded-corners-and-pure-css // http://jsfiddle.net/webtiki/umV38/ // https://www.w3.org/TR/2010/WD-css3-background-20100612/Overview.src.html //

// [ADVANCED CSS]: // https://developpaper.com/css-advanced-use-css-gradient-to-make-gorgeous-gradient-texture-background-effect/ // peelable sticker (with animation): https://codepen.io/patrickkunka/details/DeZQXw // http://www.coding-dude.com/wp/css/highlight-text-css/ // https://alvarotrigo.com/blog/css-highlight-text/