1.42.0 • Published 2 years ago

@techandtribal/combronents v1.42.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Combronents

Rapidly style your DOM elements inline, with full intellisense and type support

Features

  • No need to memorise longwinded lists of css shortcodes
  • Built in TypeScript so includes full typechecking and hints
  • Full CSS3 grid capabilities in a single key code

Install via NPM

  npm i @techandtribal/combronents

Example Usage

import { Div, H1 } from "combronents";

const GridWithTitle = () => (
    <Div
        bg_grey			// grey background
        h_full w_90pc	// full height, 90% width
        mt_3			// top margin of 3
		p_2				// all round padding of 2
        gridfixed_2x4	// 2 rows, 4 columns
		gap_2			// grid gap of 2
	>
        <H1
			font_orbitron fontsize_2 // fonts built in
		>
            Web 3 is For Our Kids To Thrive
        </H1>
    </Div>
);

App Screenshot


Usage

  1. Import Div, H1 etc.
  2. Pass it your desired Key Codes from the List of Key Codes
import { Div } from 'combronents'

const App = () => (
    <Div
        h_full w_full
    />
)

Static vs Dynamic Key Codes

Static key codes are type checked and generate styles with no customisation. For example:

<Div
    h_full
    border_solid
/>

Dynamic key codes on the other hand, allow you to customise certain key codes. For example:

<Div
    grid

/>

List of Static Key Codes

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);

Author

Pete Savva, Trader & Developer at Tech & Tribal

GitHub GitHub followers

Twitter Twitter Follow

Support

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

🚀 About Me

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

Preview

1.36.0

2 years ago

1.37.0

2 years ago

1.35.0

2 years ago

1.38.0

2 years ago

1.40.0

2 years ago

1.42.0

2 years ago

1.41.0

2 years ago

1.33.0

2 years ago

1.32.0

2 years ago

1.25.0

2 years ago

1.26.0

2 years ago

1.24.0

2 years ago

1.8.0

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago