Skip to content

Commit

Permalink
chore: adds edge case test
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdouges committed Feb 26, 2021
1 parent d21ff69 commit e740add
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
File renamed without changes.
66 changes: 66 additions & 0 deletions examples/stories/edge-cases-ordering.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { useState } from 'react';
import { styled } from '@compiled/react';

export default {
title: 'edge cases/ordering',
};

const Button = styled.a`
@media (min-width: 10px) {
color: orange;
}
`;

const Link = styled.a`
@media (min-width: 20px) {
&& {
color: red;
}
}
@media (min-width: 10px) {
color: orange;
}
`;

const MediaOrder = () => {
const [renderLink, setRenderLink] = useState(false);
const [renderButton, setRenderButton] = useState(false);

return (
<>
<label>
<input
type="checkbox"
onChange={() => setRenderLink((prev) => !prev)}
checked={renderLink}
/>
Render link
</label>

<label>
<input
type="checkbox"
onChange={() => setRenderButton((prev) => !prev)}
checked={renderButton}
/>
Render button
</label>

{renderLink && (
<div>
<Link>Hello link</Link>
</div>
)}
{renderButton && (
<div>
<Button>Hello button</Button>
</div>
)}
</>
);
};

export const MediaOrdering = () => {
return <MediaOrder />;
};

0 comments on commit e740add

Please sign in to comment.