File tree Expand file tree Collapse file tree 6 files changed +22
-5
lines changed
Expand file tree Collapse file tree 6 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 88import React from 'react' ;
99import PropTypes from 'prop-types' ;
1010import cx from 'classnames' ;
11+ import { usePrefix } from '../../internal/usePrefix' ;
1112
1213export function Layer ( {
1314 as : BaseComponent = 'div' ,
1415 className : customClassName ,
1516 children,
1617 ...rest
1718} ) {
18- const className = cx ( 'bx--layer' , customClassName ) ;
19+ const prefix = usePrefix ( ) ;
20+ const className = cx ( `${ prefix } --layer` , customClassName ) ;
1921 return (
2022 < BaseComponent { ...rest } className = { className } >
2123 { children }
Original file line number Diff line number Diff line change 88import React from 'react' ;
99import PropTypes from 'prop-types' ;
1010import cx from 'classnames' ;
11+ import { usePrefix } from '../../internal/usePrefix' ;
1112
1213const ThemeContext = React . createContext ( {
1314 theme : 'white' ,
@@ -23,11 +24,12 @@ export function Theme({
2324 theme,
2425 ...rest
2526} ) {
27+ const prefix = usePrefix ( ) ;
2628 const className = cx ( customClassName , {
27- 'bx --white' : theme === 'white' ,
28- 'bx --g10' : theme === 'g10' ,
29- 'bx --g90' : theme === 'g90' ,
30- 'bx --g100' : theme === 'g100' ,
29+ [ ` ${ prefix } --white` ] : theme === 'white' ,
30+ [ ` ${ prefix } --g10` ] : theme === 'g10' ,
31+ [ ` ${ prefix } --g90` ] : theme === 'g90' ,
32+ [ ` ${ prefix } --g100` ] : theme === 'g100' ,
3133 } ) ;
3234 const value = React . useMemo ( ( ) => {
3335 return {
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright IBM Corp. 2016, 2018
3+ *
4+ * This source code is licensed under the Apache-2.0 license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ import { unstable_usePrefix } from 'carbon-components-react' ;
9+
10+ export const usePrefix = unstable_usePrefix ;
Original file line number Diff line number Diff line change @@ -8863,5 +8863,6 @@ Map {
88638863 },
88648864 },
88658865 },
8866+ " unstable_usePrefix" => Object {},
88668867}
88678868` ;
Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ Array [
215215 "unstable_useContextMenu",
216216 "unstable_useFeatureFlag",
217217 "unstable_useFeatureFlags",
218+ "unstable_usePrefix",
218219]
219220` ) ;
220221 } ) ;
Original file line number Diff line number Diff line change @@ -230,3 +230,4 @@ export {
230230 Section as unstable_Section ,
231231} from './components/Heading' ;
232232export { default as unstable_ProgressBar } from './components/ProgressBar' ;
233+ export { usePrefix as unstable_usePrefix } from './internal/usePrefix' ;
You can’t perform that action at this time.
0 commit comments