Skip to content

Commit d567b7b

Browse files
committed
Added atoms TextInput and TextInputIcon
1 parent 534037a commit d567b7b

14 files changed

Lines changed: 243 additions & 0 deletions

src/assets/scss/4-elements/__elements.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@
1313
@import "anchors";
1414
@import "buttons";
1515
@import "checkboxes";
16+
@import "fieldsets";
17+
@import "forms";
18+
@import "headings";
1619
@import "inputs";
20+
@import "lists";
21+
@import "paragraphs";
22+
@import "text-area";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fieldset {
2+
border: none;
3+
margin: none;
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*------------------------------------*\
2+
FORMS
3+
\*------------------------------------*/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*------------------------------------*\
2+
HEADINGS
3+
\*------------------------------------*/
4+
5+
h1,
6+
h2,
7+
h3,
8+
h4,
9+
h5,
10+
h6 {
11+
-webkit-margin-before: 0;
12+
-webkit-margin-after: 0;
13+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*------------------------------------*\
2+
LISTS
3+
\*------------------------------------*/
4+
5+
ul {
6+
position: relative;
7+
list-style: none;
8+
margin-left: 0;
9+
10+
> li {
11+
@include margin-bottom(10px);
12+
}
13+
14+
&.-has-icon {
15+
li {
16+
@include padding-left(10px);
17+
}
18+
19+
&.-check > li:before {
20+
position: absolute;
21+
left: 0;
22+
font-size: 20px;
23+
}
24+
}
25+
}
26+
27+
ol {
28+
> li {
29+
@include margin-bottom(10px);
30+
}
31+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*------------------------------------*\
2+
PARAGRAPHS
3+
\*------------------------------------*/
4+
5+
p {
6+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
textarea {
2+
@include placeholder() {
3+
color: get-color-neutral("70");
4+
}
5+
@include font-style(
6+
$font-primary,
7+
"base",
8+
get-color-neutral("dark-text"),
9+
400
10+
);
11+
@include padding(13px, 18px);
12+
13+
&:focus {
14+
@include placeholder() {
15+
color: get-color-neutral("50");
16+
}
17+
}
18+
19+
border: 1px solid get-color-neutral("30");
20+
border-radius: 5px;
21+
box-sizing: border-box;
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { boolean, select } from "@storybook/addon-knobs";
2+
import { TextInputIcon } from "./text-input-icon";
3+
import React from "react";
4+
import { Icons } from "../constants/icons";
5+
import { IconSizes } from "../constants/icon-sizes";
6+
7+
export default {
8+
component: TextInputIcon,
9+
title: "Atoms | Forms / Text Input Icon",
10+
};
11+
12+
export const textInputIconKnobs = () => (
13+
<TextInputIcon
14+
icon={select("Icon", Icons, Icons.Search)}
15+
iconSize={boolean("Icon Size", true) ? IconSizes.Large : IconSizes.Base}
16+
id="text-input-icon-stories"
17+
onChange={() => {}}
18+
placeholder="Type to search..."
19+
/>
20+
);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from "react";
2+
3+
describe("TextInputIcon", () => {
4+
test.skip("TODO - https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/issues/9", () => {});
5+
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { TextInput, TextInputProps } from "./text-input";
2+
import React from "react";
3+
import { Icons } from "../constants/icons";
4+
import { IconSizes } from "../constants/icon-sizes";
5+
import { Icon } from "../icons/icon";
6+
7+
// -------------------------------------------------------------------------------------------------
8+
// #region Interfaces
9+
// -------------------------------------------------------------------------------------------------
10+
11+
export interface TextInputIconProps extends TextInputProps {
12+
icon: Icons;
13+
iconSize?: IconSizes;
14+
}
15+
16+
// #endregion Interfaces
17+
18+
// -------------------------------------------------------------------------------------------------
19+
// #region Component
20+
// -------------------------------------------------------------------------------------------------
21+
22+
const TextInputIcon: React.FC<TextInputIconProps> = (
23+
props: TextInputIconProps
24+
) => {
25+
return (
26+
<div className="c-text-input-icon">
27+
<Icon type={props.icon} size={props.iconSize || IconSizes.Large} />
28+
<TextInput {...props} />
29+
</div>
30+
);
31+
};
32+
33+
// #endregion Component
34+
35+
// -------------------------------------------------------------------------------------------------
36+
// #region Exports
37+
// -------------------------------------------------------------------------------------------------
38+
39+
export { TextInputIcon };
40+
41+
// #endregion Exports

0 commit comments

Comments
 (0)