Skip to content

Commit

Permalink
fix(styles): remove html and body styles
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinWijnant committed May 16, 2020
1 parent 2669217 commit fd05555
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 28 deletions.
2 changes: 2 additions & 0 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';

import Spinner from '../utils/Spinner/Spinner';

import cssReset from '../../css-reset.module.css';
import styles from './Button.module.css';

interface Props {
Expand All @@ -29,6 +30,7 @@ const Button: React.FC<Props> = ({
name,
}: Props) => {
const buttonClassNames = classNames(
cssReset.ventura,
styles.button,
{
[styles.typePrimary]: type === 'primary',
Expand Down
12 changes: 6 additions & 6 deletions src/components/Button/__snapshots__/Button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Button default snapshot 1`] = `
<DocumentFragment>
<button
class="button typePrimary"
class="ventura button typePrimary"
data-testid="button-undefined"
type="button"
>
Expand All @@ -19,13 +19,13 @@ exports[`Button default snapshot 1`] = `
exports[`Button loading button 1`] = `
<DocumentFragment>
<button
class="button typePrimary"
class="ventura button typePrimary"
data-testid="button-loading"
disabled=""
type="button"
>
<svg
class="svg spinner"
class="ventura svg spinner"
viewBox="0 0 150 150"
x="0px"
y="0px"
Expand All @@ -49,7 +49,7 @@ exports[`Button loading button 1`] = `
exports[`Button prefix icon button 1`] = `
<DocumentFragment>
<button
class="button typePrimary"
class="ventura button typePrimary"
data-testid="button-undefined"
type="button"
>
Expand Down Expand Up @@ -80,7 +80,7 @@ exports[`Button prefix icon button 1`] = `
exports[`Button secondary button 1`] = `
<DocumentFragment>
<button
class="button typeSecondary"
class="ventura button typeSecondary"
data-testid="button-undefined"
type="button"
>
Expand All @@ -96,7 +96,7 @@ exports[`Button secondary button 1`] = `
exports[`Button suffix icon button 1`] = `
<DocumentFragment>
<button
class="button typePrimary"
class="ventura button typePrimary"
data-testid="button-undefined"
type="button"
>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ChangeEventHandler } from 'react';
import classNames from 'classnames';

import cssReset from '../../css-reset.module.css';
import styles from './Input.module.css';

interface Props {
Expand Down Expand Up @@ -32,7 +33,7 @@ const Input = React.forwardRef<HTMLInputElement, Props>(
}: Props,
ref,
) => {
const mergedContainerClassName = classNames(styles.container, className);
const mergedContainerClassName = classNames(cssReset.ventura, styles.container, className);
const mergedInputClassName = classNames(styles.input, {
[styles.containsError]: Boolean(errorMessage),
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/__snapshots__/Input.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Input default snapshot 1`] = `
<DocumentFragment>
<div
class="container"
class="ventura container"
data-testid="container"
>
<input
Expand Down
2 changes: 2 additions & 0 deletions src/components/Radio/RadioItem/RadioItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';

import { radioContext } from '../RadioGroup/RadioGroup';

import cssReset from '../../../css-reset.module.css';
import styles from './RadioItem.module.css';

export interface Props {
Expand All @@ -28,6 +29,7 @@ const RadioItem = React.forwardRef<HTMLInputElement, Props>(
const isChecked = value === groupContext.selectedValue;

const labelClassNames = classNames(
cssReset.ventura,
styles.radioButtonContainer,
{
[styles.radioButtonContainerChecked]: isChecked,
Expand Down
12 changes: 6 additions & 6 deletions src/components/Radio/__snapshots__/Radio.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`Radio default snapshot 1`] = `
value="test1"
/>
<label
class="radioButtonContainer radioButtonContainerChecked"
class="ventura radioButtonContainer radioButtonContainerChecked"
data-testid="default-test1-container"
for="default-test1"
>
Expand Down Expand Up @@ -42,7 +42,7 @@ exports[`Radio default snapshot 1`] = `
value="test2"
/>
<label
class="radioButtonContainer"
class="ventura radioButtonContainer"
data-testid="default-test2-container"
for="default-test2"
>
Expand Down Expand Up @@ -72,7 +72,7 @@ exports[`Radio default snapshot 1`] = `
value="test3"
/>
<label
class="radioButtonContainer"
class="ventura radioButtonContainer"
data-testid="default-test3-container"
for="default-test3"
>
Expand Down Expand Up @@ -108,7 +108,7 @@ exports[`Radio description snapshot 1`] = `
value="test1"
/>
<label
class="radioButtonContainer radioButtonContainerChecked"
class="ventura radioButtonContainer radioButtonContainerChecked"
data-testid="default-test1-container"
for="default-test1"
>
Expand Down Expand Up @@ -143,7 +143,7 @@ exports[`Radio description snapshot 1`] = `
value="test2"
/>
<label
class="radioButtonContainer"
class="ventura radioButtonContainer"
data-testid="default-test2-container"
for="default-test2"
>
Expand Down Expand Up @@ -178,7 +178,7 @@ exports[`Radio description snapshot 1`] = `
value="test3"
/>
<label
class="radioButtonContainer"
class="ventura radioButtonContainer"
data-testid="default-test3-container"
for="default-test3"
>
Expand Down
3 changes: 2 additions & 1 deletion src/components/utils/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react';
import classNames from 'classnames';

import cssReset from '../../../css-reset.module.css';
import styles from './Spinner.module.css';

interface Props {
className?: string;
}

const Spinner: React.FC<Props> = ({ className }: Props) => {
const spinnerClassNames = classNames(styles.svg, className);
const spinnerClassNames = classNames(cssReset.ventura, styles.svg, className);

return (
<svg className={spinnerClassNames} x="0px" y="0px" viewBox="0 0 150 150">
Expand Down
20 changes: 8 additions & 12 deletions src/index.css → src/css-reset.module.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
@import 'theme.css';

html {
box-sizing: border-box;
}

*, *:before, *:after {
box-sizing: inherit;
}

body {
.ventura {
font-family: var(--font-family);
font-size: var(--font-size);
color: var(--font-color);
}

svg[viewBox="0 0 24 24"][stroke-linejoin="round"][stroke-linecap="round"] {
.ventura *,
.ventura *:before,
.ventura *:after {
box-sizing: border-box;
}

.ventura svg[viewBox='0 0 24 24'][stroke-linejoin='round'][stroke-linecap='round'] {
width: var(--font-size);
height: var(--font-size);
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './index.css';
import './theme.css';

export { default as Button } from './components/Button/Button';
export { default as Input } from './components/Input/Input';
Expand Down

0 comments on commit fd05555

Please sign in to comment.