Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component/input group #1405

Merged
merged 21 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d658a3a
Add new Input Group component and no wrap to button component
AriannaChau Jul 16, 2021
19ee4d6
Remove margin from stylesheet and add demo styles
AriannaChau Jul 16, 2021
6e6ffad
Change documentation
AriannaChau Jul 16, 2021
20b37be
Add changeset
AriannaChau Jul 16, 2021
dd18154
Lint test
AriannaChau Jul 16, 2021
15d87ba
Remove unused line.
AriannaChau Jul 16, 2021
5d7189b
Prevent double borders
AriannaChau Jul 16, 2021
a601947
Update src/components/input-group/demo/input-group-demo.twig
AriannaChau Jul 16, 2021
5f5c23d
Update src/components/input-group/input-group.scss
AriannaChau Jul 16, 2021
e1388c4
Update src/components/input-group/input-group.scss
AriannaChau Jul 16, 2021
4d4e1bf
Delete unused scss file
AriannaChau Jul 16, 2021
4010743
Merge branch 'component/input-group' of https://github.com/cloudfour/…
AriannaChau Jul 16, 2021
3e21750
Refine scss file
AriannaChau Jul 16, 2021
0f0ce3b
Improve code sample
AriannaChau Jul 16, 2021
b6b7b95
Change input group component to an object
AriannaChau Jul 19, 2021
179cc83
Update .changeset/chatty-papayas-juggle.md
AriannaChau Jul 19, 2021
d4ab62b
Update src/objects/input-group/demo/input-group-demo.twig
AriannaChau Jul 19, 2021
66271b4
Update src/objects/input-group/demo/input-group-demo.twig
AriannaChau Jul 19, 2021
de33088
Update src/objects/input-group/input-group.stories.mdx
AriannaChau Jul 19, 2021
276427f
Update src/objects/input-group/input-group.stories.mdx
AriannaChau Jul 19, 2021
569d272
Update src/objects/input-group/input-group.stories.mdx
AriannaChau Jul 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chatty-papayas-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudfour/patterns': minor
---

Add Input Group component
AriannaChau marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions src/components/input-group/demo/input-group-demo.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% embed '@cloudfour/objects/rhythm/rhythm.twig' %}
{% block content %}
{% embed '@cloudfour/components/input-group/input-group.twig' %}
{% block content %}
{% include '@cloudfour/components/button/button.twig' %}
{% include '@cloudfour/components/input/input.twig' %}
{% endblock %}
{% endembed %}

{% embed '@cloudfour/components/input-group/input-group.twig' %}
{% block content %}
{% include '@cloudfour/components/input/input.twig' %}
{% include '@cloudfour/components/button/button.twig' %}
{% endblock %}
{% endembed %}
{% endblock %}
{% endembed %}
19 changes: 19 additions & 0 deletions src/components/input-group/input-group.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@use "../../compiled/tokens/scss/size";

.c-input-group {
display: flex;

& > :not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}

& > :not(:last-child) {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}

& > * + * {
margin-left: -(size.$edge-medium);
}
}
35 changes: 35 additions & 0 deletions src/components/input-group/input-group.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks';
// The '!!raw-loader!' syntax is a non-standard, Webpack-specific, syntax.
// See: https://github.com/webpack-contrib/raw-loader#examples
// For now, it seems likely Storybook is pretty tied to Webpack, therefore, we are
// okay with the following Webpack-specific raw loader syntax. It's better to leave
// the ESLint rule enabled globally, and only thoughtfully disable as needed (e.g.
// within a Storybook docs page and not within an actual component).
// This can be revisited in the future if Storybook no longer relies on Webpack.
// eslint-disable-next-line @cloudfour/import/no-webpack-loader-syntax
import inputGroupDemoSource from '!!raw-loader!./demo/input-group-demo.twig';
import inputGroupDemo from './demo/input-group-demo.twig';
import './input-group.scss';

<Meta title="Components/Input Group" />
gerardo-rodriguez marked this conversation as resolved.
Show resolved Hide resolved

## Input Group

The Input Group combines the [Button](/story/components-button--button-element) and [Input](/story/components-input--text-elements) components. This would work well in creating design elements like search bars.

Buttons and inputs can be put in whatever order you choose, and the components will adjust accordingly.

<Canvas>
<Story
name="Example"
parameters={{
docs: {
source: {
code: inputGroupDemoSource,
},
},
}}
>
{inputGroupDemo}
</Story>
</Canvas>
3 changes: 3 additions & 0 deletions src/components/input-group/input-group.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="c-input-group">
{% block content %} {% endblock %}
</div>
1 change: 1 addition & 0 deletions src/mixins/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
transform transition.$quick ease.$out;
user-select: none;
vertical-align: middle;
white-space: nowrap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


/**
* Transform, opacity and filter changes are performant and will work across
Expand Down