1.27.0 • Published 10 months ago

combronents v1.27.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Logo

Combronents

Rapid inline component styling. Inbuilt Google fonts, intellisense and types.

  • Forget memorising long lists of CSS shortcodes
  • Add Google fonts to a component using only the font name
  • SSR capable with frameworks like Next

Coming soon:

  • Describe your style in a sentence, and it'll turn it into CSS
  • Remix Run template

Installation

  npm i combronents

Usage

  1. Import the Div, H1 etc. components
  2. Pass in your desired styles, use intellisense for suggestions
import { Div, H1, Section } from "combronents";

// Nested components aren't a problem
const GridWithTitle = () => (
  <Div
    grid gap_2 gtc_1fr_1fr
    h_full w_090pc>

    <H1
      mt_3 p_2 bg_grey>

      Web 3 is For Our Kids
    </H1>
  </Div>
);

// Pull in Google fonts easily
const WithGoogleFonts = () => (
  <Div font_orbitron_400 fontsize_4>
    Orbitron with weight 400
  </Div>
);

// Target child elements
const StyledChildren = () => (
  <Div child01_flex_center>
    <Section border_blue text_green>
      A section styled with flex, centered,
      and with a blue border and green text
    </Section>
  </Div>
);

Static vs Dynamic Key Codes

Static key codes are strongly typed:

<Div
  h_full
  border_solid border_green
/>

Generates this CSS:

height: full;
border: 1px solid green;

Dynamic key codes are more creative:

<Div
  gtc_1fr_2fr
/>

Generates:

display: grid;
grid-template-columns: 1fr 2fr;

Target Child Elements

<Div pos_relative child01_absolute>
  <div>
    An absolutely positioned child
  </div>
</Div>

Generates this CSS:

position: relative;

>:nth-child(1) {
  position: absolute;
}

List of Static Key Codes (INCOMPLETE)

This list does not contain all of the current styles so use intellisense to explore

Sizing

KeyMeans
h_fullheight: 100%;
h_halfheight: 50%;
w_fullwidth: 100%;
w_halfwidth: 50%;
overflow_hiddenoverflow: hidden;

Border

KeyMeans
borderborder-style: solid; border-width: 1px;
border_dashedborder-style: dashed;
border_dottedborder-style: dotted;
border_solidborder-style: solid;

Alignment

KeyMeans
ac_centeralign-content: center;
ac_startalign-content: flex-start;
ac_endalign-content: flex-end;
ac_betweenalign-content: space-between;
ac_aroundalign-content: space-around;
ac_evenlyalign-content: space-evenly;
ai_startalign-items: flex-start;
ai_endalign-items: flex-end;
ai_centeralign-items: center;
ai_baselinealign-items: baseline;
ai_stretchalign-items: stretch;
jc_startjustify-content: flex-start;
jc_endjustify-content: flex-end;
jc_centerjustify-content: center;
jc_betweenjustify-content: space-between;
jc_aroundjustify-content: space-around;
jc_evenlyjustify-content: space-evenly;
ji_startjustify-items: start;
ji_endjustify-items: end;
ji_centerjustify-items: center;
ji_stretchjustify-items: stretch;

Display

KeyMeans
display_blockdisplay: block;

Positioning

KeyMeans
bring_to_topz-index: 99999999;
pos_absoluteposition: absolute;
pos_relativeposition: relative;
top_leftposition: absolute; left: 0; top: 0;
top_centerposition: absolute; left: 50%; top: 0; transform: translateX(-50%);
top_rightposition: absolute; right: 0; top: 0;
middle_rightposition: absolute; right: 0; top: 50%; transform: translateY(-50%);
bottom_rightposition: absolute; bottom: 0; right: 0;
bottom_centerposition: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
bottom_leftposition: absolute; bottom: 0; left: 0;
middle_leftposition: absolute; left: 0; top: 50%; transform: translateY(-50%);

Flex

KeyMeans
flexdisplay: flex;
flex_centeralign-items: center; display: flex; justify-content: center;
flex_columndisplay: flex; flex-direction: column;
flex_rowdisplay: flex; flex-direction: row;

Grid

KeyMeans
griddisplay: grid;
grid_auto_columndisplay: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
grid_auto_rowdisplay: grid; grid-auto-flow: row; grid-auto-rows: 1fr;

Fonts and Text

KeyMeans
font_weight_mediumfont-weight: 500;
font_weight_boldfont-weight: 700;
text_smfont-size: 0.875rem;", "line-height: 1.25rem;
text_mdfont-size: 1rem;", "line-height: 2rem;
text_lgfont-size: 1.5rem;", "line-height: 3rem;
text_centertext-align: center;
truncateoverflow: hidden; text-overflow: ellipsis; white-space: nowrap;

Animation

KeyMeans
preserve_3dtransform-style: preserve-3d;
duration_150transition-duration: 150ms;
ease_in_outtransition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transitiontransition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;

Cursor (more to come)

KeyMeans
cursor_pointercursor: pointer;

Focus

KeyMeans
focus_outline_none&:focus { outline: none; }
focus_bg_gray_200&:focus { background-color: #E5E7EB; }

Useful Tools

KeyMeans
hidescrollbarsscrollbar-width: none; // Firefox &::-webkit-scrollbar { display: none; } // Chrome, Safari & Opera -ms-overflow-style: none; // IE and Edge

Custom Effects

KeyMeans
shadowbox-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
fluxcolor: #426DFB; font-family: 'Orbitron', sans-serif; text-shadow: 0 0 5vw rgb(77, 77, 78);
reflection_left-webkit-box-reflect: left 1px linear-gradient(transparent, #0005);
reflection_right-webkit-box-reflect: right 1px linear-gradient(transparent, #0005);

🚀 About Me

I'm Pete Savva, a day trader and developer at Tech & Tribal, and father to my newborn son Maximus.

Twitter Twitter Follow

Support

If you have any questions or feedback, please feel free to post on the GitHub Repo Your feedback is greatly appreciated.

1.27.0

10 months ago

1.22.0

10 months ago

1.26.0

10 months ago

1.18.0

1 year ago

1.19.0

1 year ago

1.20.0

1 year ago

1.15.0

1 year ago

1.14.0

1 year ago

1.13.0

1 year ago

1.12.0

1 year ago

1.17.0

1 year ago

1.16.0

1 year ago

1.11.0

1 year ago

1.10.0

1 year ago

1.3.871

2 years ago

1.3.837

2 years ago

1.3.832

2 years ago

1.3.81

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.94

2 years ago

1.2.93

2 years ago

1.2.92

2 years ago

1.2.91

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago