Skip to content

Commit

Permalink
feat(RadioButton): styles them
Browse files Browse the repository at this point in the history
  • Loading branch information
newick authored and lutangar committed Oct 15, 2020
1 parent 78aa799 commit 5c8664d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
28 changes: 28 additions & 0 deletions src/components/atoms/icons/Radio.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';

export default () => (
<svg
width="14"
height="14"
viewBox="0 0 14 14"
aria-hidden="true"
focusable="false"
>
<circle
cx="7"
cy="7"
r="6"
stroke="#0C52B4"
fill="none"
strokeWidth="1"
></circle>
<circle
cx="7"
cy="7"
r="4"
className="radio-checked"
stroke="none"
fill="none"
></circle>
</svg>
);
1 change: 1 addition & 0 deletions src/components/atoms/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export { default as Plus } from './Plus';
export { default as Pin } from './Pin';
export { default as Relay } from './Relay';
export { default as NoNotice } from './NoNotice';
export { default as Radio } from './Radio';
2 changes: 1 addition & 1 deletion src/components/molecules/Filters/FiltersCheckboxes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const FiltersListItem = styled.label`
margin-left: 30px;
}
input {
svg {
margin-right: 10px;
}
`;
Expand Down
12 changes: 12 additions & 0 deletions src/components/molecules/Filters/RadiosFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import React, { ChangeEvent } from 'react';
import styled from 'styled-components';
import { FiltersBar, FiltersList, FiltersListItem } from './FiltersCheckboxes';
import { Radio } from '../../atoms/icons';

export const TOUS = 'Tous';

const RadioButton = styled.input.attrs({ type: 'radio' })`
cursor: pointer;
position: absolute;
width: 14px;
height: 14px;
opacity: 0;
&:checked + svg {
.radio-checked {
fill: ${props => props.theme.activeColor};
}
`;

interface RadiosCheckboxesProps {
Expand All @@ -30,6 +40,7 @@ const RadiosFilters = ({
onChange={onChange}
defaultChecked
/>
<Radio />
{TOUS}
</FiltersListItem>
{!loading &&
Expand All @@ -41,6 +52,7 @@ const RadiosFilters = ({
value={filterId}
onChange={onChange}
/>
<Radio />
{filters[filterId]}
</FiltersListItem>
))}
Expand Down

0 comments on commit 5c8664d

Please sign in to comment.