Skip to content

Commit

Permalink
Merge branch 'develop' into fr/improve_main_page
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipeR13 authored Oct 29, 2024
2 parents e3e02bc + d8d39ae commit d949fde
Show file tree
Hide file tree
Showing 81 changed files with 1,116 additions and 1,151 deletions.
100 changes: 5 additions & 95 deletions assets/css/components/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@
}

.atomic-button__icon--xs {
@apply w-3 h-3;
@apply !size-3
}
.atomic-button__icon--sm {
@apply w-4 h-4;
@apply !size-4
}
.atomic-button__icon--md {
@apply w-5 h-5;
@apply !size-5
}
.atomic-button__icon--lg {
@apply w-5 h-5;
@apply !size-5
}
.atomic-button__icon--xl {
@apply w-6 h-6;
@apply !size-6
}

/* Buttons - with full width */
Expand All @@ -185,96 +185,6 @@
@apply flex items-center gap-2 whitespace-nowrap;
}

/* Icon Button */

.atomic-icon-button {
@apply inline-block p-2 rounded-full;
}

/* Icon Buttons - colors */

.atomic-icon-button--primary {
@apply text-primary-600 dark:text-primary-500;
}
.atomic-icon-button--secondary {
@apply text-secondary-600 dark:text-secondary-500;
}
.atomic-icon-button--gray {
@apply text-gray-600 dark:text-gray-500;
}
.atomic-icon-button--info {
@apply text-info-600 dark:text-info-500;
}
.atomic-icon-button--success {
@apply text-success-600 dark:text-success-500;
}
.atomic-icon-button--warning {
@apply text-warning-600 dark:text-warning-500;
}
.atomic-icon-button--danger {
@apply text-danger-600 dark:text-danger-500;
}

/* Icon Buttons - background colors */

.atomic-icon-button-bg--primary {
@apply hover:bg-primary-50 dark:hover:bg-gray-800;
}
.atomic-icon-button-bg--secondary {
@apply hover:bg-secondary-50 dark:hover:bg-gray-800;
}
.atomic-icon-button-bg--gray {
@apply hover:bg-gray-100 dark:hover:bg-gray-800;
}
.atomic-icon-button-bg--info {
@apply hover:bg-info-50 dark:hover:bg-gray-800;
}
.atomic-icon-button-bg--success {
@apply hover:bg-success-50 dark:hover:bg-gray-800;
}
.atomic-icon-button-bg--warning {
@apply hover:bg-warning-50 dark:hover:bg-gray-800;
}
.atomic-icon-button-bg--danger {
@apply hover:bg-danger-50 dark:hover:bg-gray-800;
}

/* Icon Button - sizes */

.atomic-icon-button--xs {
@apply w-9 h-9;
}
.atomic-icon-button--sm {
@apply w-10 h-10;
}
.atomic-icon-button--md {
@apply w-11 h-11;
}
.atomic-icon-button--lg {
@apply w-12 h-12;
}
.atomic-icon-button--xl {
@apply w-14 h-14;
}

/* Icon Button - spinner */

.atomic-icon-button-spinner--xs {
@apply w-5 h-5;
}
.atomic-icon-button-spinner--sm {
@apply w-6 h-6;
}
.atomic-icon-button-spinner--md {
@apply w-7 h-7;
}
.atomic-icon-button-spinner--lg {
@apply w-8 h-8;
}
.atomic-icon-button-spinner--xl {
@apply w-10 h-10;
}

/* Button - disabled */

.atomic-button--disabled {
Expand Down
39 changes: 38 additions & 1 deletion assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ module.exports = {
} else if (name.endsWith("-micro")) {
size = theme("spacing.4")
}

return {
[`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
"-webkit-mask": `var(--hero-${name})`,
Expand All @@ -101,7 +102,43 @@ module.exports = {
"height": size
}
}
}, {values})
}, { values })
}),

// Embeds Tabler icons (https://tablericons.com) into app.css bundle
plugin(function ({ matchComponents, theme }) {
let iconsDir = path.join(__dirname, "../deps/tabler_icons/icons")
let values = {}
let icons = [
["", "/outline"],
["-filled", "/filled"],
]
icons.forEach(([suffix, dir]) => {
fs.readdirSync(path.join(iconsDir, dir)).forEach(file => {
let name = path.basename(file, ".svg") + suffix
values[name] = { name, fullPath: path.join(iconsDir, dir, file) }
})
})
matchComponents({
"tabler": ({ name, fullPath }) => {
let content = fs.readFileSync(fullPath).toString()
.replace(/\r?\n|\r/g, "")
.replace(/width="[^"]*"/, "")
.replace(/height="[^"]*"/, "");

return {
[`--tabler-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
"-webkit-mask": `var(--tabler-${name})`,
"mask": `var(--tabler-${name})`,
"mask-repeat": "no-repeat",
"background-color": "currentColor",
"vertical-align": "middle",
"display": "inline-block",
"width": theme("spacing.5"),
"height": theme("spacing.5")
}
}
}, { values })
})
]
}
23 changes: 7 additions & 16 deletions lib/atomic/accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ defmodule Atomic.Accounts do
|> Ecto.Multi.delete_all(:tokens, UserToken.user_and_contexts_query(user, [context]))
end

@doc """
@doc ~S"""
Delivers the update email instructions to the given user.
## Examples
iex> deliver_update_email_instructions(
...> user,
...> current_email,
...> &Routes.user_update_email_url(conn, :edit, &1)
...> &url(~p"/users/settings/confirm_email/#{&1}")
...> )
{:ok, %{to: ..., body: ...}}
Expand Down Expand Up @@ -348,21 +348,15 @@ defmodule Atomic.Accounts do

## Confirmation

@doc """
@doc ~S"""
Delivers the confirmation email instructions to the given user.
## Examples
iex> deliver_user_confirmation_instructions(
...> user,
...> &Routes.user_confirmation_url(conn, :edit, &1)
...> )
iex> deliver_user_confirmation_instructions(user, &url(~p"/users/confirm/#{&1}"))
{:ok, %{to: ..., body: ...}}
iex> deliver_user_confirmation_instructions(
...> confirmed_user,
...> &Routes.user_confirmation_url(conn, :edit, &1)
...> )
iex> deliver_user_confirmation_instructions(confirmed_user, &url(~p"/users/confirm/#{&1}"))
{:error, :already_confirmed}
"""
Expand Down Expand Up @@ -401,15 +395,12 @@ defmodule Atomic.Accounts do

## Reset password

@doc """
@doc ~S"""
Delivers the reset password email to the given user.
## Examples
iex> deliver_user_reset_password_instructions(
...> user,
...> &Routes.user_reset_password_url(conn, :edit, &1)
...> )
iex> deliver_user_reset_password_instructions(user, &url(~p"/users/reset_password/#{&1}"))
{:ok, %{to: ..., body: ...}}
"""
Expand Down
24 changes: 17 additions & 7 deletions lib/atomic_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ defmodule AtomicWeb do
and import those modules here.
"""

def static_paths, do: ~w(assets fonts images favicon.ico robots.txt)

def controller do
quote do
use Phoenix.Controller, namespace: AtomicWeb
use Gettext, backend: AtomicWeb.Gettext

import Plug.Conn

alias AtomicWeb.Router.Helpers, as: Routes
unquote(verified_routes())
end
end

Expand Down Expand Up @@ -85,29 +87,37 @@ defmodule AtomicWeb do
end
end

def verified_routes do
quote do
use Phoenix.VerifiedRoutes,
endpoint: AtomicWeb.Endpoint,
router: AtomicWeb.Router,
statics: AtomicWeb.static_paths()
end
end

defp view_helpers do
quote do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML

# Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc)
# Import LiveView and .heex helpers (<.link>, <.form>, etc)
import Phoenix.LiveView.Helpers
import Phoenix.Component

# Import commonly used components
unquote(components())

# Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View

# Custom imports
# Custom uses, imports and aliases
unquote(components())

use AtomicWeb, :verified_routes
use Gettext, backend: AtomicWeb.Gettext

import AtomicWeb.ErrorHelpers
import AtomicWeb.Helpers

alias Atomic.Uploaders
alias AtomicWeb.Router.Helpers, as: Routes
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/atomic_web/components/activity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule AtomicWeb.Components.Activity do
</div>
<div class="min-w-0 flex-1">
<object>
<.link navigate={Routes.organization_show_path(AtomicWeb.Endpoint, :show, @activity.organization.id)}>
<.link navigate={~p"/organizations/#{@activity.organization.id}"}>
<span class="text-sm font-medium text-gray-900 hover:underline focus:outline-none">
<%= @activity.organization.name %>
</span>
Expand Down
2 changes: 1 addition & 1 deletion lib/atomic_web/components/announcement.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule AtomicWeb.Components.Announcement do
</div>
<div class="min-w-0 flex-1">
<object>
<.link navigate={Routes.organization_show_path(AtomicWeb.Endpoint, :show, @announcement.organization.id)} class="hover:underline focus:outline-none">
<.link navigate={~p"/organizations/#{@announcement.organization.id}"} class="hover:underline focus:outline-none">
<p class="text-sm font-medium text-gray-900">
<%= @announcement.organization.name %>
</p>
Expand Down
Loading

0 comments on commit d949fde

Please sign in to comment.