File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1+ import { Fragment } from 'react' ;
2+
13import StructuredEventData from 'sentry/components/structuredEventData' ;
24import storyBook from 'sentry/stories/storyBook' ;
35import useOrganization from 'sentry/utils/useOrganization' ;
46
57export default storyBook ( 'useOrganization' , story => {
6- story ( 'useOrganization - via StructuredEventData ' , ( ) => {
8+ story ( 'Default ' , ( ) => {
79 const org = useOrganization ( ) ;
8- return < StructuredEventData data = { org } /> ;
10+
11+ // Sort features and access alphabetically for the story use case
12+ org . features . sort ( ( a , b ) => a . localeCompare ( b ) ) ;
13+ org . access . sort ( ( a , b ) => a . localeCompare ( b ) ) ;
14+
15+ return (
16+ < Fragment >
17+ < p >
18+ < code > useOrganization</ code > returns the currently selected organization.
19+ </ p >
20+ In the context of the Sentry dashboard, only a single organization can be selected
21+ at a time.
22+ < p >
23+ A common need to use < code > useOrganization</ code > is to check for feature flags
24+ via < code > organization.features.includes(feature)</ code > . Note that our feature
25+ names are currently not typed, so you need to make sure you pass in the correct
26+ feature name.
27+ </ p >
28+ < StructuredEventData data = { org } />
29+ </ Fragment >
30+ ) ;
931 } ) ;
1032} ) ;
Original file line number Diff line number Diff line change 1+ import { Fragment } from 'react' ;
2+
3+ import StructuredEventData from 'sentry/components/structuredEventData' ;
4+ import storyBook from 'sentry/stories/storyBook' ;
5+
6+ import { useUser } from './useUser' ;
7+
8+ export default storyBook ( 'useUser' , story => {
9+ story ( 'useUser' , ( ) => {
10+ const user = useUser ( ) ;
11+
12+ return (
13+ < Fragment >
14+ < p >
15+ < code > useUser</ code > returns the currently logged in user.
16+ </ p >
17+ < StructuredEventData data = { user } />
18+ </ Fragment >
19+ ) ;
20+ } ) ;
21+ } ) ;
You can’t perform that action at this time.
0 commit comments