Skip to content

Commit

Permalink
Merge pull request #327 from BouyguesTelecom/fix/divider-margins
Browse files Browse the repository at this point in the history
delete margin from next/previous element divider
  • Loading branch information
JulienMora authored Jan 27, 2025
2 parents 646809d + 2150fec commit a121915
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions examples/react-template/screens/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import { Box, BoxContent, Divider, IconName, Section, Text } from '@trilogy-ds/react/components'
import { Row, Rows, Spacer, SpacerSize } from '@trilogy-ds/react'
import { Box, BoxContent, Divider, IconName, Section, Text } from '@trilogy-ds/react/lib/components'
import { GapSize } from '@trilogy-ds/react/lib/components/columns/ColumnsTypes'
import * as React from 'react'

export const DividerScreen = (): JSX.Element => {
return (
Expand Down
12 changes: 6 additions & 6 deletions packages/react/components/divider/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react'
import { DividerProps } from './DividerProps'
import { is, has } from '@/services/classify'
import { Icon, IconSize } from '../icon'
import clsx from 'clsx'
import { hashClass } from '@/helpers'
import { DividerProps } from '@/components/divider/DividerProps'
import { Icon, IconSize } from '@/components/icon'
import { useTrilogyContext } from '@/context'
import { hashClass } from '@/helpers/hashClassesHelpers'
import { has, is } from '@/services/classify'
import clsx from 'clsx'
import React from 'react'

/**
* Divider Component
Expand Down
12 changes: 0 additions & 12 deletions packages/styles/framework/src/components/_autolayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ body:not(.is-tight) {
.box:not(:last-child) {
margin-bottom: 24px;
}
*:has(+ .divider):not(:last-child) {
margin-bottom: 24px;
}
.divider:not(:last-child) {
margin-bottom: 24px;
}
.table:not(:last-child) {
margin-bottom: 24px;
}
Expand Down Expand Up @@ -183,12 +177,6 @@ body:not(.is-tight) {
.box:not(:last-child) {
margin-bottom: 16px;
}
*:has(+ .divider):not(:last-child) {
margin-bottom: 16px;
}
.divider:not(:last-child) {
margin-bottom: 16px;
}
.table:not(:last-child) {
margin-bottom: 16px;
}
Expand Down
16 changes: 16 additions & 0 deletions packages/styles/framework/src/components/_divider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,20 @@
padding: 0 $spacing-4;
background-color: invertColor('neutral');
}

&:not(.is-marginless) {
margin: $spacing-5 0;
}

@include mobile {
&:not(.is-marginless) {
margin: $spacing-4 0;
}
}
}

*:has(+ .divider) {
margin-top: 0 !important;
margin-bottom: 0 !important;
}

2 changes: 0 additions & 2 deletions packages/styles/scripts/autolayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export const DEFAULT_SPACING_MATRIX: DefaultSpacingMatrix = [
[INSERT_SPACE_BETWEEN, '.card', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.columns', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.box', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '*:has(+ .divider)', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.divider', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.table', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.list', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.timeline', 'default', FIVE, FOUR],
Expand Down

0 comments on commit a121915

Please sign in to comment.