From 4046d1ecfba8ac778d04e67c2f931dcf6d09dec5 Mon Sep 17 00:00:00 2001 From: Christoph Werner Date: Thu, 23 Feb 2017 11:45:55 +0100 Subject: [PATCH] Add react-sticky use case --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 83edd4f..cb0fcdd 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,11 @@ const Component = styledProperty(WrappedComponent, 'propName')` ` ``` ## Use Cases + +### react-router `Link` + Set default and active styles of `Link` component from [`react-router`](https://github.com/ReactTraining/react-router). + ```javascript import { Link } from 'react-router' import styled from 'styled-components' @@ -38,3 +42,26 @@ const StyledLink = styledProperty(BaseLink, 'activeClassName')` color: #bada55; ` ``` + +### react-sticky `Sticky` + +Set default and sticky styles of `Sticky` component from [`react-sticky`](https://github.com/captivationsoftware/react-sticky). + +```javascript +import { Sticky } from 'react-sticky' +import styled from 'styled-components' +import styledProperty from 'styled-property' + +// create basic Sticky styles +const BaseSticky = styled(Sticky)` + margin-top: 0; + transition: margin-top .3s ease-in-out; +` + +// create an additional set of style rules and set the "stickyClassName" +// property of the wrapped component (BaseSticky) to the auto-generated +// className for those styles. +const StyledSticky = styledProperty(BaseSticky, 'stickyClassName')` + margin-top: 16px; +` +```