Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Re-add spacings and shadows

Oliver Günther59965ebaa412
diff --git a/spec/components/docs/styles/04-icons.md.erb b/spec/components/docs/styles/02-icons.md.erb
similarity index 100%
rename from spec/components/docs/styles/04-icons.md.erb
rename to spec/components/docs/styles/02-icons.md.erb
diff --git a/spec/components/docs/styles/02-colors.md.erb b/spec/components/docs/styles/03-colors.md.erb
similarity index 100%
rename from spec/components/docs/styles/02-colors.md.erb
rename to spec/components/docs/styles/03-colors.md.erb
diff --git a/spec/components/docs/styles/04-spacings.md.erb b/spec/components/docs/styles/04-spacings.md.erb
new file mode 100644
index 00000000000..522aae160c2
--- /dev/null
+++ b/spec/components/docs/styles/04-spacings.md.erb
@@ -0,0 +1,58 @@
+---
+title: Spacings
+---
+
+**Note:** These are still SPOT-defined spacings and need to be adapted for primer.
+
+<div class="spacings">
+<%
+tokens = JSON.parse File.read(Rails.root.join('frontend/src/app/spot/styles/tokens/dist/tokens.json'))
+tokens
+ .select { |k, v| k.start_with?('spot-spacing-') }
+ .sort_by { |k, | k.split('-')[2].gsub('_', '.').to_f }
+ .each do |name, value|
+ %>
+<div class="spacings--spacing">
+ <div class="spacings--name"><%= name %></div>
+ <div class="spacings--value"><%= value %></div>
+ <div
+ class="spacings--preview"
+ style="height: <%= value %>"></div>
+</div>
+<% end %>
+</div>
+
+<style>
+.spacings {
+ display: flex;
+ flex-wrap: wrap;
+ margin-right: -1rem;
+}
+
+.spacings--spacing {
+ margin-bottom: 1rem;
+ margin-right: 1rem;
+ display: flex;
+ align-items: center;
+ width: 100%;
+}
+
+.spacings--spacing > * {
+ flex-basis: 30%;
+}
+
+.spacings--preview {
+ background-color: #507193;
+ flex-shrink: 1;
+ flex-basis: 100%;
+}
+
+.spacings--name {
+ font-weight: bold;
+ padding: 0.3rem;
+}
+
+.spacings--value {
+ padding: 0.3rem;
+}
+</style>
diff --git a/spec/components/docs/styles/05-shadows.md.erb b/spec/components/docs/styles/05-shadows.md.erb
new file mode 100644
index 00000000000..19831d8a435
--- /dev/null
+++ b/spec/components/docs/styles/05-shadows.md.erb
@@ -0,0 +1,95 @@
+---
+title: Shadows
+---
+
+**Note:** These are still SPOT-defined shadows and need to be replaced by primer
+
+Shadows are important when certain components are displayed on top of other components. This is usually the case with contextual menus, drop-downs or dialogues that supplement or expand an existing view.
+
+Although it is best to avoid layering beyond two levels (a base screen + an overlay), it is sometimes necessary and indeed unavoidable.
+
+We use different shadows to communicate depth and allow the user to intuitively understand what is "on top".
+
+Our shadows definitions divided between Light and Hard and three levels of elevation. The shadow is always based on a black #000000 transparency level, a X and Y px value and a spread px value.
+
+<%
+cols = ['Low', 'Mid', 'High']
+rows = ['Light', 'Hard']
+tokens = JSON.parse File.read(Rails.root.join('frontend/src/app/spot/styles/tokens/dist/tokens.json'))
+tokens = tokens
+ .select { |k, v| k.start_with?('spot-shadow-') }
+ .sort_by { |k, | k.split('-')[2].gsub('_', '.').to_f }
+ .to_h
+ %>
+
+<table class="shadows">
+ <tbody>
+ <tr>
+ <td></td>
+ <% cols.each do |col| %>
+ <td><%= col %></td>
+ <% end %>
+ </tr>
+ <% rows.each do |row| %>
+ <tr>
+ <td><%= row %></td>
+ <% cols.each do |col| %>
+ <% key = "spot-shadow-#{row.downcase}-#{col.downcase}" %>
+ <td>
+ <div class="shadows--preview" style="box-shadow: <%= tokens[key] %>">
+ <div class="shadows--name"><%= key %></div>
+ <div class="shadows--value"><%= tokens[key] %></div>
+ </div>
+ </td>
+ <% end %>
+ </tr>
+<% end %>
+ </tbody>
+</table>
+
+
+<style>
+.shadows {
+ margin-right: -1rem;
+}
+
+.shadows tr,
+.shadows td {
+ background: transparent !important;
+ border: 0 !important;
+}
+
+.shadows td {
+ padding: 2rem !important;
+ text-align: center;
+}
+
+.shadows--spacing {
+ margin-bottom: 1rem;
+ margin-right: 1rem;
+ display: flex;
+ align-items: center;
+ width: 100%;
+}
+
+.shadows--spacing > * {
+ flex-basis: 30%;
+}
+
+.shadows--preview {
+ border-radius: 3px;
+ flex-shrink: 1;
+ flex-basis: 100%;
+ padding: 1rem;
+}
+
+.shadows--name {
+ font-weight: bold;
+ padding: 0.3rem;
+}
+
+.shadows--value {
+ padding: 0.3rem;
+ white-space: nowrap;
+}
+</style>
diff --git a/spec/components/docs/styles/03-focus.md.erb b/spec/components/docs/styles/06-focus.md.erb
similarity index 100%
rename from spec/components/docs/styles/03-focus.md.erb
rename to spec/components/docs/styles/06-focus.md.erb