This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Highlighter): allow rendering to custom tag (#11)
* feat(Highlighter): allow rendering to custom tag * add jsdoc
- Loading branch information
Showing
14 changed files
with
347 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@kadira/storybook'; | ||
import { Highlight, Hits } from '../packages/react-instantsearch/dom'; | ||
import { withKnobs, text } from '@kadira/storybook-addon-knobs'; | ||
import { WrapWithHits } from './util'; | ||
|
||
const stories = storiesOf('Highlight', module); | ||
|
||
stories.addDecorator(withKnobs); | ||
|
||
const Default = ({ hit }) => ( | ||
<article> | ||
<p> | ||
<Highlight attributeName="name" hit={hit} /> | ||
</p> | ||
<p> | ||
<Highlight attributeName="description" hit={hit} /> | ||
</p> | ||
</article> | ||
); | ||
|
||
Default.propTypes = { | ||
hit: React.PropTypes.object.isRequired, | ||
}; | ||
|
||
const StrongHits = ({ hit }) => ( | ||
<article> | ||
<p> | ||
<Highlight | ||
attributeName="name" | ||
tagName={text('tag name (title)', 'strong')} | ||
hit={hit} | ||
/> | ||
</p> | ||
<p> | ||
<Highlight | ||
attributeName="description" | ||
tagName={text('tag name (description)', 'strong')} | ||
hit={hit} | ||
/> | ||
</p> | ||
</article> | ||
); | ||
|
||
StrongHits.propTypes = { | ||
hit: React.PropTypes.object.isRequired, | ||
}; | ||
|
||
stories | ||
.add('default', () => ( | ||
<WrapWithHits hasPlayground={true} linkedStoryGroup="Highlight"> | ||
<Hits hitComponent={Default} /> | ||
</WrapWithHits> | ||
)) | ||
.add('playground', () => ( | ||
<WrapWithHits linkedStoryGroup="Highlight"> | ||
<Hits hitComponent={StrongHits} /> | ||
</WrapWithHits> | ||
)); |
Oops, something went wrong.