Skip to content

Commit

Permalink
feature(bc-footer): Move Sepator Styles To Its Own Token
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Zeni committed Mar 11, 2022
1 parent c3ba7f4 commit 33e8f47
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 12 deletions.
14 changes: 2 additions & 12 deletions packages/cx-layout/src/components/FooterMenu/Menus/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
replaceWith,
} from '@bodiless/fclasses';
import { asBodilessMenu, withListSubMenu, withMenuDesign } from '@bodiless/navigation';
import { cxSeparator } from '../tokens';
import { FooterSubMenu } from './SubMenu';

const MenuClean = asBodilessMenu()(Ul);
Expand Down Expand Up @@ -51,19 +52,8 @@ const Base = asMenuToken({
Wrapper: 'w-full md:flex md:justify-between md:flex-grow lg:h-full',
Item: 'md:w-1/4',
},
Spacing: {
Item: as(
'mb-9 pb-9 last:mb-0 last:pb-0',
'md:mb-0 md:pb-0 md:px-10 md:first:pl-0 md:last:pr-0',
'lg:px-12 lg:first:pl-12',
),
},
Theme: {
Item: as(
'border-white-400 border-b last:border-0',
'md:border-b-0 md:border-l md:last:border-l md:first:border-0',
'lg:first:border-l',
),
Item: cxSeparator.Default,
Title: flowHoc(
as(
cxColor.TextPrimaryFooterCopy,
Expand Down
37 changes: 37 additions & 0 deletions packages/cx-layout/src/components/FooterMenu/tokens/cxSeparator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright © 2022 Johnson & Johnson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { asTokenGroup } from '@bodiless/cx-elements';
import { as } from '@bodiless/fclasses';

const meta = {
categories: {
Type: ['Element'],
},
};

// @TODO: Right now, default is implemented for footer, but this can potentially
// be extended to other components, then the separator should be moved to higher scope.
export default asTokenGroup(meta)({
Default: as(
// Separator borders.
'border-white-400 border-b last:border-0',
'md:border-b-0 md:border-l md:last:border-l md:first:border-0',
'lg:first:border-l',
// Separator spacings.
'mb-9 pb-9 last:mb-0 last:pb-0',
'md:mb-0 md:pb-0 md:px-10 md:first:pl-0 md:last:pr-0',
'lg:px-12 lg:first:pl-12',
),
});
17 changes: 17 additions & 0 deletions packages/cx-layout/src/components/FooterMenu/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright © 2022 Johnson & Johnson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import cxSeparator from './cxSeparator';

export { cxSeparator };

0 comments on commit 33e8f47

Please sign in to comment.