Skip to content

Commit

Permalink
Merge pull request #17 from department-of-veterans-affairs/6541-fix-s…
Browse files Browse the repository at this point in the history
…torybook-web-styling

Fix Storybook web
  • Loading branch information
narin authored Sep 14, 2023
2 parents 1927b2b + 8d10c9e commit 3cf4b7b
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ coverage

.yarn/*
.yarn/cache
packages/components/.yarn/install-state.gz
packages/components/.yarn/cache

!.yarn/patches
Expand Down
1 change: 1 addition & 0 deletions packages/components/.storybook/web/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ module.exports = {
builder: 'webpack5',
},
framework: '@storybook/react',
staticDirs: ['../../src/assets'],
}
12 changes: 12 additions & 0 deletions packages/components/.storybook/web/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<style>
@font-face {
font-family: 'SourceSansPro-Regular';
src: url('fonts/SourceSansPro/SourceSansPro-Regular.ttf');
}

@font-face {
font-family: 'SourceSansPro-Bold';
src: url('fonts/SourceSansPro/SourceSansPro-Bold.ttf');
}

</style>
Binary file removed packages/components/.yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"storybook:deploy": "yarn storybook:build && gh-pages -d storybook-static",
"storybook:generate": "sb-rn-get-stories --config-path .storybook/native",
"storybook:watch": "sb-rn-watcher --config-path .storybook/native",
"storybook:web": "start-storybook --config-dir .storybook/web -p 6006",
"storybook:web": "STORYBOOK_WEB=true start-storybook --config-dir .storybook/web -p 6006",
"test": "jest --coverage",
"test:watch": "jest --watch"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const meta: Meta<SegmentedControlProps> = {
decorators: [
(Story) => (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Story />
{Story()}
</View>
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'react-native'
import { useTranslation } from 'react-i18next'
import React, { FC, useEffect } from 'react'
import styled from 'styled-components'
import styled from 'styled-components/native'

import { ComponentWrapper } from '../../wrapper'

Expand Down Expand Up @@ -83,7 +83,7 @@ export const SegmentedControl: FC<SegmentedControlProps> = ({
}

const viewStyle: ViewStyle = {
alignSelf: 'baseline',
alignSelf: 'stretch',
backgroundColor: inactiveBgColor,
borderRadius: 8,
flexDirection: 'row',
Expand Down Expand Up @@ -134,7 +134,8 @@ export const SegmentedControl: FC<SegmentedControlProps> = ({
accessibilityHint={a11yHints ? a11yHints[index] : ''}
accessibilityValue={accessibilityValue}
accessibilityRole={'tab'}
accessibilityState={{ selected: isSelected }}>
accessibilityState={{ selected: isSelected }}
>
<Text allowFontScaling={false} style={textStyle}>
{label}
</Text>
Expand Down
9 changes: 7 additions & 2 deletions packages/components/src/utils/translation/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ export const resources = {
}

// Initialize the internationalization library

// Use RNLanguageDetector only if mobile
if (process.env.STORYBOOK_WEB !== 'true') {
i18n.use(RNLanguageDetector)
}


i18n
.use(RNLanguageDetector)
.use(initReactI18next)
.init({
resources,
Expand All @@ -26,5 +32,4 @@ i18n
useSuspense: true,
},
})

export default i18n

0 comments on commit 3cf4b7b

Please sign in to comment.